Skip to content

Instantly share code, notes, and snippets.

@photofroggy
Created February 16, 2013 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save photofroggy/4969121 to your computer and use it in GitHub Desktop.
Save photofroggy/4969121 to your computer and use it in GitHub Desktop.
settings.bds = {
// Main DSP channel.
mns: 'chat:datashare',
ns: [],
// Check if we should be processing messages from a given channel.
channel: function( ns ) {
if( !ns )
return false;
ns = client.format_ns(ns).toLowerCase();
return settings.bds.ns.indexOf( ns ) > -1;
},
// Add a channel
add: function( ns ) {
if( !ns )
return false;
ns = client.format_ns(ns).toLowerCase();
if( settings.bds.ns.indexOf( ns ) > -1 )
return true;
settings.bds.ns.push( ns );
return true;
},
// Remove a channel
remove: function( ns ) {
if( !ns )
return false;
ns = client.format_ns(ns).toLowerCase();
if( settings.bds.ns.indexOf( ns ) == -1 )
return true;
settings.bds.ns.splice( settings.bds.ns.indexOf( ns ), 1 );
return true;
},
// Because it's fun spamming #ds
'provides': [
'BOTCHECK',
'CLINK'
]
};
// Allow other parts of client to use the channel listing.
client.bds = settings.bds;
settings.bds.add(settings.bds.mns);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment