Changeset 4143 for trunk/console

Show
Ignore:
Timestamp:
07/08/05 07:32:16 (3 years ago)
Author:
emostar
Message:

Don't need to load protocol plugins anymore.

Fix tabbing with users. Allow using UINs once again.

Location:
trunk/console/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/console/src/console.cpp

    r4139 r4143  
    247247  m_nPipe = _licqDaemon->RegisterPlugin(SIGNAL_ALL); 
    248248  m_bExit = false;  
    249   _licqDaemon->AddProtocolPlugins(); 
    250249  licqDaemon = _licqDaemon; 
    251250  m_nCurrentGroup = gUserManager.DefaultGroup(); 
     
    13101309        nTabs = 2; 
    13111310      } 
     1311      free(szMatch); 
    13121312      winPrompt->RefreshWin(); 
    13131313      break; 
  • trunk/console/src/console.h

    r4139 r4143  
    216216{ 
    217217  vector <char *> vszPartialMatch; 
    218   char szPartialMatch[32]; 
     218  char *szPartialMatch; 
    219219}; 
    220220 
  • trunk/console/src/console_menu.cpp

    r3922 r4143  
    747747      FOR_EACH_PROTO_USER_BREAK; 
    748748    } 
     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    } 
    749755  } 
    750756  FOR_EACH_USER_END 
     
    9941000 * CLicqConsole::MenuRemove 
    9951001 *-------------------------------------------------------------------------*/ 
    996 //TODO: add support for other protocols 
    9971002void CLicqConsole::MenuRemove(char *szArg) 
    9981003{ 
    9991004  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)) 
    10031008    winMain->wprintf("%CYou can't remove yourself!\n", 16); 
    1004   else if (nUin == 0) 
     1009  else if (!scon.szId && scon.nPPID != (unsigned long)-1) 
    10051010    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); 
    10111013} 
    10121014 
  • trunk/console/src/console_tab.cpp

    r2293 r4143  
    2121                              struct STabCompletion &_sTabCompletion) 
    2222{ 
    23   char szMatch[32] = ""; 
     23  char *szMatch = 0; 
    2424  unsigned short nLen = strlen(_szPartialMatch); 
    2525  for (unsigned short i = 0; i < NUM_COMMANDS; i++) 
     
    2929    if (strncasecmp(_szPartialMatch, szTempCmd, nLen) == 0) 
    3030    { 
    31       if (szMatch[0] == '\0') 
    32         strcpy(szMatch, szTempCmd); 
     31      if (szMatch == 0) 
     32        szMatch = strdup(szTempCmd); 
    3333      else 
    3434        szMatch[StrMatchLen(szMatch, szTempCmd, nLen)] = '\0'; 
     
    3737  } 
    3838  if (nLen == 0) 
    39     _sTabCompletion.szPartialMatch[0] = '\0'; 
     39    _sTabCompletion.szPartialMatch = 0; 
    4040  else 
    41     strcpy(_sTabCompletion.szPartialMatch, szMatch); 
     41    _sTabCompletion.szPartialMatch = szMatch; 
    4242} 
    4343 
     
    4949                           struct STabCompletion &_sTabCompletion) 
    5050{ 
    51   char szMatch[32] = ""; 
     51  char *szMatch = 0; 
    5252  unsigned short nLen; 
    5353/*  char *szSubCmd = NULL; 
     
    7676      if (strncasecmp(_szPartialMatch, pUser->GetAlias(), nLen) == 0) 
    7777      { 
    78         if (szMatch[0] == '\0') 
    79           strcpy(szMatch, pUser->GetAlias()); 
     78        if (szMatch == 0) 
     79          szMatch = strdup(pUser->GetAlias()); 
    8080        else 
    8181          szMatch[StrMatchLen(szMatch, pUser->GetAlias(), nLen)] = '\0'; 
    8282        _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())); 
    8391      } 
    8492    } 
     
    8694 
    8795    if (nLen == 0) 
    88       _sTabCompletion.szPartialMatch[0] = '\0'; 
     96      _sTabCompletion.szPartialMatch = 0; 
    8997    else 
    90       strcpy(_sTabCompletion.szPartialMatch, szMatch); 
     98      _sTabCompletion.szPartialMatch = szMatch; 
    9199  } 
    92100/*  else // Sub command time 
     
    122130                             struct STabCompletion &_sTabCompletion) 
    123131{ 
    124   char szMatch[32] = ""; 
     132  char *szMatch = 0; 
    125133  unsigned short nLen = strlen(_szPartialMatch); 
    126134  for (unsigned short i = 0; i < NUM_STATUS; i++) 
     
    128136    if (strncasecmp(_szPartialMatch, aStatus[i].szName, nLen) == 0) 
    129137    { 
    130       if (szMatch[0] == '\0') 
    131         strcpy(szMatch, aStatus[i].szName); 
     138      if (szMatch == 0) 
     139        szMatch = strdup(aStatus[i].szName); 
    132140      else 
    133141        szMatch[StrMatchLen(szMatch, aStatus[i].szName, nLen)] = '\0'; 
     
    136144  } 
    137145  if (nLen == 0) 
    138     _sTabCompletion.szPartialMatch[0] = '\0'; 
     146    _sTabCompletion.szPartialMatch = 0; 
    139147  else 
    140     strcpy(_sTabCompletion.szPartialMatch, szMatch); 
     148    _sTabCompletion.szPartialMatch = szMatch; 
    141149} 
    142150 
     
    148156                          struct STabCompletion &_sTabCompletion) 
    149157{ 
    150   char szMatch[32] = ""; 
     158  char *szMatch = 0; 
    151159  unsigned short nLen = strlen(_szPartialMatch); 
    152160  for (unsigned short i = 0; i < NUM_VARIABLES; i++) 
     
    154162    if (strncasecmp(_szPartialMatch, aVariables[i].szName, nLen) == 0) 
    155163    { 
    156       if (szMatch[0] == '\0') 
    157         strcpy(szMatch, aVariables[i].szName); 
     164      if (szMatch == 0) 
     165        szMatch = strdup(aVariables[i].szName); 
    158166      else 
    159167        szMatch[StrMatchLen(szMatch, aVariables[i].szName, nLen)] = '\0'; 
     
    162170  } 
    163171  if (nLen == 0) 
    164     _sTabCompletion.szPartialMatch[0] = '\0'; 
     172    _sTabCompletion.szPartialMatch = 0; 
    165173  else 
    166     strcpy(_sTabCompletion.szPartialMatch, szMatch); 
     174    _sTabCompletion.szPartialMatch = szMatch; 
    167175} 
    168176