Skip to content

Commit

Permalink
got rid of some more pointless methods in the channel object. started…
Browse files Browse the repository at this point in the history
… work on moving the title and topic change notices to the ui lib. #73.
  • Loading branch information
Henry Rapley committed Apr 21, 2013
1 parent 9c24e22 commit f0b96dd
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 96 deletions.
19 changes: 15 additions & 4 deletions dist/chatterbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1353,14 +1353,25 @@ Chatterbox.Channel.prototype.log_pc = function( privileges, data ) {
*
* @method set_header
* @param head {String} Should be 'title' or 'topic'.
* @param content {Object} Content for the header.
* @param content {Object} Content for the header
* @param by {String} Username of the person who set the header
* @param ts {String} Timestamp for when the header was set
*/
Chatterbox.Channel.prototype.set_header = function( head, content ) {
Chatterbox.Channel.prototype.set_header = function( head, content, by, ts ) {

head = head.toLowerCase();
var edit = this.el.m.find('header.' + head + ' a[href=#edit]');
//var c = this.manager.client.channel( this.namespace );

this.el.h[head].html(content.html());
if( this.el.h[head].html() != '' ) {

if ( content.html().length != 0 ) {
this.server_message( prop + " set by " + by );
}

}

this.el.h[head].html( content.html() );

var chan = this;

Expand Down Expand Up @@ -1886,7 +1897,7 @@ Chatterbox.Channel.prototype.pkt_property = function( event, client ) {
switch(prop) {
case "title":
case "topic":
this.set_header(prop, event.value || (new wsc.MessageString));
this.set_header(prop, event.value || (new wsc.MessageString), event.by, event.ts );
break;
case "privclasses":
this.build_user_list( c.info.pc, c.info.pc_order.slice(0) );
Expand Down
10 changes: 5 additions & 5 deletions dist/chatterbox.min.js

Large diffs are not rendered by default.

32 changes: 22 additions & 10 deletions dist/wsc.dAmn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ wsc.Channel.prototype.build = function( ) {
* @method log_whois
* @deprecated
* @param data {Object} Object containing a user's information.
*/
*
wsc.Channel.prototype.log_whois = function( data ) {
if( this.ui == null )
return;
Expand All @@ -1054,7 +1054,7 @@ wsc.Channel.prototype.log_whois = function( data ) {
* @deprecated
* @param privileges {Boolean} Are we showing privileges or users?
* @param data {Array} Array containing information.
*/
*
wsc.Channel.prototype.log_pc = function( privileges, data ) {
if( this.ui == null )
return;
Expand All @@ -1072,13 +1072,14 @@ wsc.Channel.prototype.property = function( e ) {

switch(prop) {
case "title":
case "topic":
// If we already had the title/topic for this channel, then it was changed. Output a message.
case "topic":
/* If we already had the title/topic for this channel, then it was changed. Output a message.
if ( this.info[prop].content.length != 0 ) {
if ( ( e.pkt.arg.ts - this.info[prop].ts ) != 0 ) {
this.ui.server_message(prop + " set by " + e.pkt["arg"]["by"]);
}
}
*/

this.set_header(prop, e);
break;
Expand Down Expand Up @@ -2738,7 +2739,7 @@ wsc.defaults.Extension = function( client ) {
data.connections.push(conn);
}

client.cchannel.log_whois(data);
client.ui.chatbook.current.log_whois(data);
};

var pkt_get = function( event, client ) {
Expand Down Expand Up @@ -2778,7 +2779,7 @@ wsc.defaults.Extension = function( client ) {
}
}

chan.log_pc(event.p == 'privclass', pcs);
client.ui.chatbook.current.log_pc(event.p == 'privclass', pcs);

};

Expand Down Expand Up @@ -5720,14 +5721,25 @@ Chatterbox.Channel.prototype.log_pc = function( privileges, data ) {
*
* @method set_header
* @param head {String} Should be 'title' or 'topic'.
* @param content {Object} Content for the header.
* @param content {Object} Content for the header
* @param by {String} Username of the person who set the header
* @param ts {String} Timestamp for when the header was set
*/
Chatterbox.Channel.prototype.set_header = function( head, content ) {
Chatterbox.Channel.prototype.set_header = function( head, content, by, ts ) {

head = head.toLowerCase();
var edit = this.el.m.find('header.' + head + ' a[href=#edit]');
//var c = this.manager.client.channel( this.namespace );

if( this.el.h[head].html() != '' ) {

if ( content.html().length != 0 ) {
this.server_message( prop + " set by " + by );
}

}

this.el.h[head].html(content.html());
this.el.h[head].html( content.html() );

var chan = this;

Expand Down Expand Up @@ -6253,7 +6265,7 @@ Chatterbox.Channel.prototype.pkt_property = function( event, client ) {
switch(prop) {
case "title":
case "topic":
this.set_header(prop, event.value || (new wsc.MessageString));
this.set_header(prop, event.value || (new wsc.MessageString), event.by, event.ts );
break;
case "privclasses":
this.build_user_list( c.info.pc, c.info.pc_order.slice(0) );
Expand Down
31 changes: 15 additions & 16 deletions dist/wsc.dAmn.min.js

Large diffs are not rendered by default.

32 changes: 22 additions & 10 deletions dist/wsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ wsc.Channel.prototype.build = function( ) {
* @method log_whois
* @deprecated
* @param data {Object} Object containing a user's information.
*/
*
wsc.Channel.prototype.log_whois = function( data ) {
if( this.ui == null )
return;
Expand All @@ -1054,7 +1054,7 @@ wsc.Channel.prototype.log_whois = function( data ) {
* @deprecated
* @param privileges {Boolean} Are we showing privileges or users?
* @param data {Array} Array containing information.
*/
*
wsc.Channel.prototype.log_pc = function( privileges, data ) {
if( this.ui == null )
return;
Expand All @@ -1072,13 +1072,14 @@ wsc.Channel.prototype.property = function( e ) {

switch(prop) {
case "title":
case "topic":
// If we already had the title/topic for this channel, then it was changed. Output a message.
case "topic":
/* If we already had the title/topic for this channel, then it was changed. Output a message.
if ( this.info[prop].content.length != 0 ) {
if ( ( e.pkt.arg.ts - this.info[prop].ts ) != 0 ) {
this.ui.server_message(prop + " set by " + e.pkt["arg"]["by"]);
}
}
*/

this.set_header(prop, e);
break;
Expand Down Expand Up @@ -2738,7 +2739,7 @@ wsc.defaults.Extension = function( client ) {
data.connections.push(conn);
}

client.cchannel.log_whois(data);
client.ui.chatbook.current.log_whois(data);
};

var pkt_get = function( event, client ) {
Expand Down Expand Up @@ -2778,7 +2779,7 @@ wsc.defaults.Extension = function( client ) {
}
}

chan.log_pc(event.p == 'privclass', pcs);
client.ui.chatbook.current.log_pc(event.p == 'privclass', pcs);

};

Expand Down Expand Up @@ -5720,14 +5721,25 @@ Chatterbox.Channel.prototype.log_pc = function( privileges, data ) {
*
* @method set_header
* @param head {String} Should be 'title' or 'topic'.
* @param content {Object} Content for the header.
* @param content {Object} Content for the header
* @param by {String} Username of the person who set the header
* @param ts {String} Timestamp for when the header was set
*/
Chatterbox.Channel.prototype.set_header = function( head, content ) {
Chatterbox.Channel.prototype.set_header = function( head, content, by, ts ) {

head = head.toLowerCase();
var edit = this.el.m.find('header.' + head + ' a[href=#edit]');
//var c = this.manager.client.channel( this.namespace );

if( this.el.h[head].html() != '' ) {

if ( content.html().length != 0 ) {
this.server_message( prop + " set by " + by );
}

}

this.el.h[head].html(content.html());
this.el.h[head].html( content.html() );

var chan = this;

Expand Down Expand Up @@ -6253,7 +6265,7 @@ Chatterbox.Channel.prototype.pkt_property = function( event, client ) {
switch(prop) {
case "title":
case "topic":
this.set_header(prop, event.value || (new wsc.MessageString));
this.set_header(prop, event.value || (new wsc.MessageString), event.by, event.ts );
break;
case "privclasses":
this.build_user_list( c.info.pc, c.info.pc_order.slice(0) );
Expand Down
Loading

0 comments on commit f0b96dd

Please sign in to comment.