[ABD] AJAX Chat

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
jimcarrel
Registered User
Posts: 671
Joined: Fri Jul 27, 2007 10:49 pm
Location: Oklahoma City, Oklahoma

Re: [RC] AJAX Chat

Post by jimcarrel » Sat Sep 27, 2008 12:17 pm

In folder chat/lib/config.php

Code: Select all

// Defines if login/logout and channel enter/leave are displayed:
$config['showChannelMessages'] = false;
change true to false, and chatbot login and logout will not show.
Grace--Getting what I don't deserve
Mercy--Not getting what I do deserve

br0nks
Registered User
Posts: 13
Joined: Wed May 02, 2007 12:11 am

Re: [RC] AJAX Chat

Post by br0nks » Sat Sep 27, 2008 12:40 pm

thanks so much:)


and..:) have next one question..:)
i read that:
http://ajax-chat.wiki.sourceforge.net/C ... e+commands

and i want to make my own command like: /hockey and if someone will write this, system will shown links to hockey.. but.. that script dosnt work ;/

and i have some errors in script...
this same i have when i want to add this:
http://sourceforge.net/docman/display_d ... _id=214758
or this:
http://sourceforge.net/docman/display_d ... _id=214758

:? can someone help me? or give me working code?

thanks.

Craig Snyder
Registered User
Posts: 73
Joined: Sat May 19, 2007 2:45 pm

Re: [RC] AJAX Chat

Post by Craig Snyder » Sat Sep 27, 2008 4:12 pm

Code: Select all

// Defines the hour of the day the chat is opened (0 - closingHour):
$config['openingHour'] = 0;
// Defines the hour of the day the chat is closed (openingHour - 24):
$config['closingHour'] = 24;
This does not make sense to me...

What values should I use if I want my chat to open at 6pm and close at midnight?

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sat Sep 27, 2008 5:47 pm

Craig Snyder wrote:What values should I use if I want my chat to open at 6pm and close at midnight?
Try

Code: Select all

$config['openingHour'] = 18;
br0nks wrote:and..:) have next one question..:)
i read that:
http://ajax-chat.wiki.sourceforge.net/C ... e+commands

and i want to make my own command like: /hockey and if someone will write this, system will shown links to hockey.. but.. that script dosnt work ;/
The script should work as it is. I guess you wanted to say
that you don't know how to replace /hockey with urls.
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

Craig Snyder
Registered User
Posts: 73
Joined: Sat May 19, 2007 2:45 pm

Re: [RC] AJAX Chat

Post by Craig Snyder » Sat Sep 27, 2008 5:51 pm

Yeah, Itried 18 and it doesn't work... the formula it provides or whatever makes absolutely no sense. 0 - closingHour? openingHour - 24?

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sat Sep 27, 2008 5:58 pm

Craig Snyder wrote:Yeah, Itried 18 and it doesn't work... the formula it provides or whatever makes absolutely no sense. 0 - closingHour? openingHour - 24?
Strange somehow. On my test board it works perfectly using these settings.

Code: Select all

// Defines the hour of the day the chat is opened (0 - closingHour):
$config['openingHour'] = 18;
// Defines the hour of the day the chat is closed (openingHour - 24):
$config['closingHour'] = 24;
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

Craig Snyder
Registered User
Posts: 73
Joined: Sat May 19, 2007 2:45 pm

Re: [RC] AJAX Chat

Post by Craig Snyder » Sat Sep 27, 2008 7:37 pm

How are you simulating time like that to test it? Does it go by your webhost's server time, or you phpBB default time?

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sat Sep 27, 2008 7:59 pm

$config['timeZoneOffset'] = null; so the server timezone will be used there

and here is how it works ::

Code: Select all

		$time = time();
		if($this->getConfig('timeZoneOffset') !== null) {
			// Subtract the server timezone offset and add the config timezone offset:
			$time -= date('Z', $time);
			$time += $this->getConfig('timeZoneOffset');
		}
		// Check the opening hours:
		if(($this->getConfig('openingHour') > date('G', $time)) || ($this->getConfig('closingHour') <= date('G', $time)))
			return false;
taken from chat/lib/class/AJAXChat.php
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

br0nks
Registered User
Posts: 13
Joined: Wed May 02, 2007 12:11 am

Re: [RC] AJAX Chat

Post by br0nks » Sat Sep 27, 2008 8:36 pm

hi, i change myip to hokej and in lang file change that same and text what i want.. but.. i want to make new one called /soccer and dont know how to add ;/ cause look here:

Code: Select all

 // Return true if a custom command has been successfully parsed, else false
    // $text contains the whole message, $textParts the message split up as words array
    function parseCustomCommands($text, $textParts) {
        switch($textParts[0]) {
            // Display userIP:
            case '/hokej':
                $this->insertChatBotMessage(
                    $this->getPrivateMessageID(),
                    '/hokej '.$this->getSessionIP() 
                );
                return true;
            default:
                return false;
        }
    }

how to change: '/hokej '.$this->getSessionIP() to get normal text not sessionIP ?

Craig Snyder
Registered User
Posts: 73
Joined: Sat May 19, 2007 2:45 pm

Re: [RC] AJAX Chat

Post by Craig Snyder » Sat Sep 27, 2008 9:55 pm

So the 'server' time is your phpBB's default timezone set using the ACP?

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sat Sep 27, 2008 11:42 pm

System timezone = Server timezone

If your server is located in another timezone
you may have to specify the offset value.
br0nks wrote:how to change: '/hokej '.$this->getSessionIP() to get normal text not sessionIP ?
Try server-sided (CustomAJAXChat.php)

Code: Select all

'/hokej normal text' 
instead of

Code: Select all

'/hokej '.$this->getSessionIP()
and client-sided (custom.js)

Code: Select all

      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
instead of

Code: Select all

      case '/myip':
         return '<span class="chatBotMessage">' + this.lang['myip'].replace(/%s/, textParts[1]) + '</span>';
Hope it helps.
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

br0nks
Registered User
Posts: 13
Joined: Wed May 02, 2007 12:11 am

Re: [RC] AJAX Chat

Post by br0nks » Sun Sep 28, 2008 10:33 am

easygo wrote:System timezone = Server timezone

If your server is located in another timezone
you may have to specify the offset value.
br0nks wrote:how to change: '/hokej '.$this->getSessionIP() to get normal text not sessionIP ?
Try server-sided (CustomAJAXChat.php)

Code: Select all

'/hokej normal text' 
instead of

Code: Select all

'/hokej '.$this->getSessionIP()
and client-sided (custom.js)

Code: Select all

      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
instead of

Code: Select all

      case '/myip':
         return '<span class="chatBotMessage">' + this.lang['myip'].replace(/%s/, textParts[1]) + '</span>';
Hope it helps.
hm... but look, if i want to have two commands like: /hokej and /soccer so i need add twice everything?

i give you ex:
CustomAJAXChat.php

Code: Select all

    // hokej
    function parseCustomCommands($text, $textParts) {
        switch($textParts[0]) {
            // Display hokej:
            case '/hokej':
                $this->insertChatBotMessage(
                    $this->getPrivateMessageID(),
                    '/hokej normal text '
                );
                return true;
            default:
                return false;
        }
    }

 // soccer
    function parseCustomCommands($text, $textParts) {
        switch($textParts[0]) {
            // Display hokej:
            case '/soccer':
                $this->insertChatBotMessage(
                    $this->getPrivateMessageID(),
                    '/soccer normal text '
                );
                return true;
            default:
                return false;
        }
    }
then:
custom.js

Code: Select all

 // hokej
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}

 // soccer
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/soccer':
         return '<span class="chatBotMessage">' + this.lang['soccer'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}
and file of language.js:

Code: Select all

	hokej: 'hokej text',
	soccer: 'soccer text',

but it dont work;/ i try to change in CustomAJAXChat.php and custom.js this: "CustomCommands" to two different words like: Custom1Commands and Custom2Commands and still dont work..

can u modyfi this to good one?
thanks!

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sun Sep 28, 2008 10:59 am

br0nks wrote:then:
custom.js

Code: Select all

 // hokej
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}

 // soccer
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/soccer':
         return '<span class="chatBotMessage">' + this.lang['soccer'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}
and file of language.js:

Code: Select all

	hokej: 'hokej text',
	soccer: 'soccer text',

but it dont work;/ i try to change in CustomAJAXChat.php and custom.js this: "CustomCommands" to two different words like: Custom1Commands and Custom2Commands and still dont work..

can u modyfi this to good one?
thanks!
Sorry but this way is a bad way, of course. :roll:

Code: Select all

	hokej: 'hokej text',
	soccer: 'soccer text',
should be something like this

Code: Select all

	hokej: 'hokej text: %s',
	soccer: 'soccer text: %s',
and

Code: Select all

 // hokej
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
      case '/soccer':
         return '<span class="chatBotMessage">' + this.lang['soccer'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}

 // soccer
ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/soccer':
         return '<span class="chatBotMessage">' + this.lang['soccer'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}
should be

Code: Select all

ajaxChat.replaceCustomCommands = function(text, textParts) {
   switch(textParts[0]) {
      case '/hokej':
         return '<span class="chatBotMessage">' + this.lang['hokej'].replace(/%s/, textParts[1]) + '</span>';
      case '/soccer':
         return '<span class="chatBotMessage">' + this.lang['soccer'].replace(/%s/, textParts[1]) + '</span>';
      default:
         return text;
   }
}
and if you want to have 3 or 4 or 5 custom commands ;) well then
just do it 3 or 4 or 5 more times in the same way. You all right?
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

br0nks
Registered User
Posts: 13
Joined: Wed May 02, 2007 12:11 am

Re: [RC] AJAX Chat

Post by br0nks » Sun Sep 28, 2008 11:50 am

ok, but what with CustomAJAXChat.php ?

how it look need?

User avatar
easygo
Registered User
Posts: 689
Joined: Sun Oct 31, 2004 4:23 pm
Contact:

Re: [RC] AJAX Chat

Post by easygo » Sun Sep 28, 2008 3:29 pm

br0nks wrote:ok, but what with CustomAJAXChat.php ?

how it look need?
Dead similar to the other one! ;) Try this way

Code: Select all

function parseCustomCommands($text, $textParts)
{switch($textParts[0]) {
case '/hokej':
$this->insertChatBotMessage(
$this->getPrivateMessageID(),
'/hokej blah'
);
return true;
case '/soccer':
$this->insertChatBotMessage(
$this->getPrivateMessageID(),
'/soccer blah'
);
return true;
default:
return false;
}
}
instead of yours :/ easy
Casual developer for AJAX Chat on behalf of the author / Arcade Center powered by phpBB Arcade

A problem well put is half solved. (John Dewey, 1859–1952)

Locked

Return to “[3.0.x] Abandoned MODs”