Changeset 4143 for trunk/console
- Timestamp:
- 07/08/05 07:32:16 (3 years ago)
- Location:
- trunk/console/src
- Files:
-
- 4 modified
-
console.cpp (modified) (2 diffs)
-
console.h (modified) (1 diff)
-
console_menu.cpp (modified) (2 diffs)
-
console_tab.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/src/console.cpp
r4139 r4143 247 247 m_nPipe = _licqDaemon->RegisterPlugin(SIGNAL_ALL); 248 248 m_bExit = false; 249 _licqDaemon->AddProtocolPlugins();250 249 licqDaemon = _licqDaemon; 251 250 m_nCurrentGroup = gUserManager.DefaultGroup(); … … 1310 1309 nTabs = 2; 1311 1310 } 1311 free(szMatch); 1312 1312 winPrompt->RefreshWin(); 1313 1313 break; -
trunk/console/src/console.h
r4139 r4143 216 216 { 217 217 vector <char *> vszPartialMatch; 218 char szPartialMatch[32];218 char *szPartialMatch; 219 219 }; 220 220 -
trunk/console/src/console_menu.cpp
r3922 r4143 747 747 FOR_EACH_PROTO_USER_BREAK; 748 748 } 749 else if (strcasecmp(szAlias, pUser->IdString()) == 0) 750 { 751 scon.szId = pUser->IdString(); 752 scon.nPPID = pUser->PPID(); 753 FOR_EACH_PROTO_USER_BREAK; 754 } 749 755 } 750 756 FOR_EACH_USER_END … … 994 1000 * CLicqConsole::MenuRemove 995 1001 *-------------------------------------------------------------------------*/ 996 //TODO: add support for other protocols997 1002 void CLicqConsole::MenuRemove(char *szArg) 998 1003 { 999 1004 char *sz = szArg; 1000 unsigned long nUin = GetUinFromArg(&sz);1001 1002 if ( nUin == gUserManager.OwnerUin())1005 struct SContact scon = GetContactFromArg(&sz); 1006 1007 if (gUserManager.FindOwner(scon.szId, scon.nPPID)) 1003 1008 winMain->wprintf("%CYou can't remove yourself!\n", 16); 1004 else if ( nUin == 0)1009 else if (!scon.szId && scon.nPPID != (unsigned long)-1) 1005 1010 winMain->wprintf("%CYou must specify a user to remove.\n", 16); 1006 else if (nUin != (unsigned long)-1) 1007 { 1008 sprintf(szArg, "%lu", nUin); 1009 UserCommand_Remove(szArg, LICQ_PPID, sz); 1010 } 1011 else 1012 UserCommand_Remove(scon.szId, scon.nPPID, sz); 1011 1013 } 1012 1014 -
trunk/console/src/console_tab.cpp
r2293 r4143 21 21 struct STabCompletion &_sTabCompletion) 22 22 { 23 char szMatch[32] = "";23 char *szMatch = 0; 24 24 unsigned short nLen = strlen(_szPartialMatch); 25 25 for (unsigned short i = 0; i < NUM_COMMANDS; i++) … … 29 29 if (strncasecmp(_szPartialMatch, szTempCmd, nLen) == 0) 30 30 { 31 if (szMatch [0] == '\0')32 s trcpy(szMatch,szTempCmd);31 if (szMatch == 0) 32 szMatch = strdup(szTempCmd); 33 33 else 34 34 szMatch[StrMatchLen(szMatch, szTempCmd, nLen)] = '\0'; … … 37 37 } 38 38 if (nLen == 0) 39 _sTabCompletion.szPartialMatch [0] = '\0';39 _sTabCompletion.szPartialMatch = 0; 40 40 else 41 strcpy(_sTabCompletion.szPartialMatch, szMatch);41 _sTabCompletion.szPartialMatch = szMatch; 42 42 } 43 43 … … 49 49 struct STabCompletion &_sTabCompletion) 50 50 { 51 char szMatch[32] = "";51 char *szMatch = 0; 52 52 unsigned short nLen; 53 53 /* char *szSubCmd = NULL; … … 76 76 if (strncasecmp(_szPartialMatch, pUser->GetAlias(), nLen) == 0) 77 77 { 78 if (szMatch [0] == '\0')79 s trcpy(szMatch,pUser->GetAlias());78 if (szMatch == 0) 79 szMatch = strdup(pUser->GetAlias()); 80 80 else 81 81 szMatch[StrMatchLen(szMatch, pUser->GetAlias(), nLen)] = '\0'; 82 82 _sTabCompletion.vszPartialMatch.push_back(strdup(pUser->GetAlias())); 83 } 84 else if (strncasecmp(_szPartialMatch, pUser->IdString(), nLen) == 0) 85 { 86 if (szMatch == 0) 87 szMatch = strdup(pUser->IdString()); 88 else 89 szMatch[StrMatchLen(szMatch, pUser->IdString(), nLen)] = '\0'; 90 _sTabCompletion.vszPartialMatch.push_back(strdup(pUser->IdString())); 83 91 } 84 92 } … … 86 94 87 95 if (nLen == 0) 88 _sTabCompletion.szPartialMatch [0] = '\0';96 _sTabCompletion.szPartialMatch = 0; 89 97 else 90 strcpy(_sTabCompletion.szPartialMatch, szMatch);98 _sTabCompletion.szPartialMatch = szMatch; 91 99 } 92 100 /* else // Sub command time … … 122 130 struct STabCompletion &_sTabCompletion) 123 131 { 124 char szMatch[32] = "";132 char *szMatch = 0; 125 133 unsigned short nLen = strlen(_szPartialMatch); 126 134 for (unsigned short i = 0; i < NUM_STATUS; i++) … … 128 136 if (strncasecmp(_szPartialMatch, aStatus[i].szName, nLen) == 0) 129 137 { 130 if (szMatch [0] == '\0')131 s trcpy(szMatch,aStatus[i].szName);138 if (szMatch == 0) 139 szMatch = strdup(aStatus[i].szName); 132 140 else 133 141 szMatch[StrMatchLen(szMatch, aStatus[i].szName, nLen)] = '\0'; … … 136 144 } 137 145 if (nLen == 0) 138 _sTabCompletion.szPartialMatch [0] = '\0';146 _sTabCompletion.szPartialMatch = 0; 139 147 else 140 strcpy(_sTabCompletion.szPartialMatch, szMatch);148 _sTabCompletion.szPartialMatch = szMatch; 141 149 } 142 150 … … 148 156 struct STabCompletion &_sTabCompletion) 149 157 { 150 char szMatch[32] = "";158 char *szMatch = 0; 151 159 unsigned short nLen = strlen(_szPartialMatch); 152 160 for (unsigned short i = 0; i < NUM_VARIABLES; i++) … … 154 162 if (strncasecmp(_szPartialMatch, aVariables[i].szName, nLen) == 0) 155 163 { 156 if (szMatch [0] == '\0')157 s trcpy(szMatch,aVariables[i].szName);164 if (szMatch == 0) 165 szMatch = strdup(aVariables[i].szName); 158 166 else 159 167 szMatch[StrMatchLen(szMatch, aVariables[i].szName, nLen)] = '\0'; … … 162 170 } 163 171 if (nLen == 0) 164 _sTabCompletion.szPartialMatch [0] = '\0';172 _sTabCompletion.szPartialMatch = 0; 165 173 else 166 strcpy(_sTabCompletion.szPartialMatch, szMatch);174 _sTabCompletion.szPartialMatch = szMatch; 167 175 } 168 176
