Skip to content

Commit

Permalink
handle dashes in room names
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd committed Jan 23, 2012
1 parent ff9c90d commit dab7d8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ var client;
function toDBName(host, room) {
if (!host || !room) throw 'missing required args';
if (room.substr(0,1) === "#") room = room.substr(1);
host = host.replace('-', '_');
return (host.replace(/\./g, '$') + "$$" + room);
}

function fromDBName(dbName) {
var ar = dbName.split('$$');
return {
host: ar[0].replace(/\$/g, '.'),
host: ar[0].replace('_', '-')replace(/\$/g, '.'),
room: ar[1]
};
}
Expand Down

0 comments on commit dab7d8e

Please sign in to comment.