refactor(socket) Util.isContainStrAtBegin -> equalPart

This commit is contained in:
coderaiser 2013-11-14 08:28:37 +00:00
parent 3f4ed02f40
commit fdac6fb121

View file

@ -11,6 +11,7 @@
exec = main.child_process.exec,
Util = main.util,
mainpackage = main.mainpackage,
equalPart = Util.isContainStrAtBegin,
CLOUDCMD = mainpackage.name,
ClientFuncs = [],
OnMessageFuncs = [],
@ -126,9 +127,9 @@
connName = '#' + pConnNum + ': ';
Util.log(connName + pCommand);
if (Util.isContainStrAtBegin(pCommand, CLOUDCMD))
if (equalPart(pCommand, CLOUDCMD))
lRet = onCloudCmd(pCommand);
else if( Util.isContainStrAtBegin(pCommand, 'cd ') )
else if (equalPart(pCommand, 'cd '))
lRet = onCD(pCommand);
if (lRet)
@ -236,10 +237,10 @@
pCommand = Util.removeStr(pCommand, CLOUDCMD);
if( Util.isContainStrAtBegin(pCommand, ' ') ) {
if (equalPart(pCommand, ' ')) {
pCommand = Util.removeStr(pCommand, ' ');
if( Util.isContainStrAtBegin(pCommand, 'update') && update ) {
if (equalPart(pCommand, 'update') && update) {
update.get();
lRet = {
stdout: Util.addNewLine('update: ok')