Skip to content

Commit

Permalink
clean up. making pc build happen through events. direct refence to ui…
Browse files Browse the repository at this point in the history
… in pc building method removed. #73.
  • Loading branch information
Henry Rapley committed Apr 21, 2013
1 parent 7f24485 commit 543fd94
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 42 deletions.
7 changes: 7 additions & 0 deletions dist/chatterbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ Chatterbox.UI.prototype.build = function( control, navigation, chatbook ) {
}
);

this.client.bind(
'ns.set.privclasses',
function( event, client ) {
ui.channel( event.ns ).build_user_list( event.names, event.orders );
}
);

};

/**
Expand Down
14 changes: 7 additions & 7 deletions dist/chatterbox.min.js

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions dist/wsc.dAmn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,12 @@ wsc.Channel = function( client, ns, hidden, monitor ) {
* @method build
*/
wsc.Channel.prototype.build = function( ) {

this.info.members = {};
this.set_privclasses( { pkt: { body: '' } } );

if( this.namespace[0] == '@' )
this.set_privclasses( { pkt: { body: '' } } );

};

/**
Expand Down Expand Up @@ -1149,7 +1153,15 @@ wsc.Channel.prototype.set_privclasses = function( e ) {
var names = this.info.pc;
var orders = this.info.pc_order.slice(0);

this.ui.build_user_list( names, orders );
this.client.trigger(
'ns.set.privclasses',
{
name: 'ns.set.privclasses',
ns: this.namespace,
names: names,
orders: orders
}
);
};

/**
Expand Down Expand Up @@ -1212,7 +1224,7 @@ wsc.Channel.prototype.set_user_list = function( ) {

this.client.trigger(this.namespace + '.user.list', {
'name': 'set.userlist',
'ns': this.info['namespace'],
'ns': this.namespace,
'users': users
});
};
Expand Down Expand Up @@ -4707,6 +4719,13 @@ Chatterbox.UI.prototype.build = function( control, navigation, chatbook ) {
}
);

this.client.bind(
'ns.set.privclasses',
function( event, client ) {
ui.channel( event.ns ).build_user_list( event.names, event.orders );
}
);

};

/**
Expand Down
26 changes: 13 additions & 13 deletions dist/wsc.dAmn.min.js

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions dist/wsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,12 @@ wsc.Channel = function( client, ns, hidden, monitor ) {
* @method build
*/
wsc.Channel.prototype.build = function( ) {

this.info.members = {};
this.set_privclasses( { pkt: { body: '' } } );

if( this.namespace[0] == '@' )
this.set_privclasses( { pkt: { body: '' } } );

};

/**
Expand Down Expand Up @@ -1149,7 +1153,15 @@ wsc.Channel.prototype.set_privclasses = function( e ) {
var names = this.info.pc;
var orders = this.info.pc_order.slice(0);

this.ui.build_user_list( names, orders );
this.client.trigger(
'ns.set.privclasses',
{
name: 'ns.set.privclasses',
ns: this.namespace,
names: names,
orders: orders
}
);
};

/**
Expand Down Expand Up @@ -1212,7 +1224,7 @@ wsc.Channel.prototype.set_user_list = function( ) {

this.client.trigger(this.namespace + '.user.list', {
'name': 'set.userlist',
'ns': this.info['namespace'],
'ns': this.namespace,
'users': users
});
};
Expand Down Expand Up @@ -4707,6 +4719,13 @@ Chatterbox.UI.prototype.build = function( control, navigation, chatbook ) {
}
);

this.client.bind(
'ns.set.privclasses',
function( event, client ) {
ui.channel( event.ns ).build_user_list( event.names, event.orders );
}
);

};

/**
Expand Down
26 changes: 13 additions & 13 deletions dist/wsc.min.js

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions src/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ wsc.Channel = function( client, ns, hidden, monitor ) {
* @method build
*/
wsc.Channel.prototype.build = function( ) {

this.info.members = {};
this.set_privclasses( { pkt: { body: '' } } );

if( this.namespace[0] == '@' )
this.set_privclasses( { pkt: { body: '' } } );

};

/**
Expand Down Expand Up @@ -167,7 +171,15 @@ wsc.Channel.prototype.set_privclasses = function( e ) {
var names = this.info.pc;
var orders = this.info.pc_order.slice(0);

this.ui.build_user_list( names, orders );
this.client.trigger(
'ns.set.privclasses',
{
name: 'ns.set.privclasses',
ns: this.namespace,
names: names,
orders: orders
}
);
};

/**
Expand Down Expand Up @@ -230,7 +242,7 @@ wsc.Channel.prototype.set_user_list = function( ) {

this.client.trigger(this.namespace + '.user.list', {
'name': 'set.userlist',
'ns': this.info['namespace'],
'ns': this.namespace,
'users': users
});
};
Expand Down
7 changes: 7 additions & 0 deletions src/ui/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ Chatterbox.UI.prototype.build = function( control, navigation, chatbook ) {
}
);

this.client.bind(
'ns.set.privclasses',
function( event, client ) {
ui.channel( event.ns ).build_user_list( event.names, event.orders );
}
);

};

/**
Expand Down

0 comments on commit 543fd94

Please sign in to comment.