Force channel names to be lowercase

Since MySQL is case-insensitive, treating varying cases as unique names was a prroblem.
Existing channels with uppercase names should not be affected as the database lookup finds a match without case sensitivity.
This commit is contained in:
calzoneman 2013-04-05 14:03:35 -05:00
parent 823ab91d04
commit b7cdc0c056
3 changed files with 3 additions and 2 deletions

View File

@ -87,7 +87,7 @@ exports.loadChannel = function(chan) {
return; return;
} }
else if(rows[0].name != chan.name) { else if(rows[0].name != chan.name) {
return rows[0].name; chan.name = rows[0].name;
} }
chan.registered = true; chan.registered = true;

View File

@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
const VERSION = "1.1.2"; const VERSION = "1.1.3";
var fs = require("fs"); var fs = require("fs");
var Logger = require("./logger.js"); var Logger = require("./logger.js");

View File

@ -46,6 +46,7 @@ User.prototype.initCallbacks = function() {
return; return;
if(data.name.length > 100) if(data.name.length > 100)
return; return;
data.name = data.name.toLowerCase();
// Channel already loaded // Channel already loaded
if(data.name in Server.channels) { if(data.name in Server.channels) {
this.channel = Server.channels[data.name]; this.channel = Server.channels[data.name];