Changeset 3801 for trunk/console

Show
Ignore:
Timestamp:
08/09/04 23:48:55 (4 years ago)
Author:
emostar
Message:

* Fix some documentation for the help.
* Add support for $ (last user)

Location:
trunk/console/src
Files:
6 modified

Legend:

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

    r3768 r3801  
    23232323        winMain->wprintf("%C%AGranting authorizing to %s...", m_cColorInfo->nColor, 
    23242324                         m_cColorInfo->nAttr, data->szId); 
    2325         winMain->event = licqDaemon->icqAuthorizeGrant(strtoul(data->szId, (char **)NULL, 10), data->szMsg); 
     2325        winMain->event = licqDaemon->ProtoAuthorizeGrant(data->szId, data->nPPID, data->szMsg); 
    23262326      } 
    23272327      else 
     
    23292329        winMain->wprintf("%C%ARefusing authorizing to %s...", m_cColorInfo->nColor, 
    23302330                         m_cColorInfo->nAttr, data->szId); 
    2331         winMain->event = licqDaemon->icqAuthorizeRefuse(strtoul(data->szId, (char **)NULL, 10), data->szMsg); 
     2331        winMain->event = licqDaemon->ProtoAuthorizeRefuse(data->szId, data->nPPID, data->szMsg); 
    23322332      } 
    23332333 
  • trunk/console/src/console.h

    r3768 r3801  
    3535  bool bOffline; 
    3636  const struct SColorMap *color; 
    37 }; 
    38  
    39 struct SContact 
    40 { 
    41   char *szId; 
    42   unsigned long nPPID; 
    4337}; 
    4438 
  • trunk/console/src/console_menu.cpp

    r3768 r3801  
    9292    "a space.  The command can be any valid command, do not\n" 
    9393    "prepend the command character when defining.\n" 
    94     "Example: \"/define r last message\" creates a macro \"r\"\n" 
     94    "Example: \"/define r message $\" creates a macro \"r\"\n" 
    9595    "which replies to the last user you talked to."}, 
    9696  { "help", &CLicqConsole::MenuHelp, NULL, 
     
    352352 * CLicqConsole::MenuAuthorize 
    353353 *-------------------------------------------------------------------------*/ 
    354 //TODO: update for other protocols 
    355354void CLicqConsole::MenuAuthorize(char *szArg) 
    356355{ 
    357356  if (szArg == NULL) 
    358357  { 
    359     winMain->wprintf("%CSpecify \"grant/refuse\" and a UIN to authorize.\n", COLOR_RED); 
     358    winMain->wprintf("%CSpecify \"grant/refuse\" and a UIN/Screen Name to authorize.\n", COLOR_RED); 
    360359    return; 
    361360  } 
     
    372371    bGrant = false; 
    373372    szArg += 6; 
    374   } 
    375  
    376   // Try to change groups 
    377   int nUin = atol(szArg); 
    378    
    379   if (nUin == 0) 
    380   { 
    381     winMain->wprintf("%CUIN must be non-zero.\n", COLOR_RED); 
    382     return; 
    383373  } 
    384374 
     
    394384 
    395385  return; 
    396  
    397  
    398386} 
    399387 
     
    617605    szCmd = strchr(szCmd, ' '); 
    618606  } 
    619   //TODO - fix this 
    620   //else if (szArg[0] == '#') 
    621   //{ 
    622   //  *p_szArg = NULL; 
    623   //  return gUserManager.OwnerUin(); 
    624   //} 
    625   //else if (szArg[0] == '$') 
    626   //{ 
    627   //  *p_szArg = NULL; 
    628   //  return winMain->nLastUin; 
    629   //} 
     607  else if (szArg[0] == '#') 
     608  { 
     609    *p_szArg = NULL; 
     610    ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
     611    scon.szId = o->IdString(); 
     612    scon.nPPID = o->PPID();  
     613    gUserManager.DropOwner(); 
     614    return scon; 
     615  } 
     616  else if (szArg[0] == '$') 
     617  { 
     618    *p_szArg = NULL; 
     619    return winMain->sLastContact; 
     620  } 
    630621  else 
    631622  { 
     
    659650  } 
    660651  
    661   //TODO 
    662652  // Save this as the last user 
    663   //if (winMain->nLastUin != nUin) 
    664   //{ 
    665   //  winMain->nLastUin = nUin; 
    666   //  PrintStatus(); 
    667   //} 
     653  if (winMain->sLastContact.szId == 0 || 
     654      !(strcmp(scon.szId, winMain->sLastContact.szId) == 0 && 
     655      scon.nPPID == winMain->sLastContact.nPPID)) 
     656  { 
     657    if (winMain->sLastContact.szId) 
     658      free(winMain->sLastContact.szId); 
     659    winMain->sLastContact.nPPID = scon.nPPID; 
     660    winMain->sLastContact.szId = strdup(scon.szId); 
     661    PrintStatus(); 
     662  } 
    668663 
    669664  return scon; 
  • trunk/console/src/console_print.cpp

    r3768 r3801  
    141141    strcpy(szMsgStr, "No Messages"); 
    142142 
    143   if (winMain->nLastUin != 0) 
    144   { 
    145     ICQUser *u = gUserManager.FetchUser(winMain->nLastUin, LOCK_R); 
     143  if (winMain->sLastContact.szId != 0) 
     144  { 
     145    ICQUser *u = gUserManager.FetchUser(winMain->sLastContact.szId, 
     146      winMain->sLastContact.nPPID, LOCK_R); 
    146147    if (u == NULL) 
    147148      strcpy(szLastUser, "<Removed>"); 
     
    293294    s->bOffline = pUser->StatusOffline(); 
    294295 
    295     unsigned long iStatus = pUser->StatusFull(); 
    296  
    297     if(iStatus & ICQ_STATUS_FxPRIVATE) 
     296    unsigned short nStatus = pUser->Status(); 
     297 
     298    if(pUser->StatusInvisible()) 
    298299    { 
    299300      szTmp = pUser->usprintf(m_szOtherOnlineFormat); 
     
    301302    } 
    302303 
    303     if((unsigned short)iStatus == ICQ_STATUS_OFFLINE) 
     304    else if(nStatus == ICQ_STATUS_OFFLINE) 
    304305    { 
    305306      szTmp = pUser->usprintf(m_szOfflineFormat); 
    306307      s->color = m_cColorOffline; 
    307308    } 
    308     else if( (unsigned short) iStatus != ICQ_STATUS_OFFLINE && 
    309         ((iStatus & ICQ_STATUS_DND) || (iStatus & ICQ_STATUS_OCCUPIED) || 
    310         (iStatus & ICQ_STATUS_NA) || (iStatus & ICQ_STATUS_AWAY))) 
     309    else if(nStatus == ICQ_STATUS_DND || nStatus == ICQ_STATUS_OCCUPIED || 
     310            nStatus == ICQ_STATUS_NA || nStatus == ICQ_STATUS_AWAY) 
    311311    { 
    312312      szTmp = pUser->usprintf(m_szAwayFormat); 
    313313      s->color = m_cColorAway; 
    314314    } 
    315     else if((unsigned short)iStatus == ICQ_STATUS_FREEFORCHAT) 
     315    else if(nStatus == ICQ_STATUS_FREEFORCHAT) 
    316316    { 
    317317      szTmp = pUser->usprintf(m_szOtherOnlineFormat); 
    318318      s->color = m_cColorOnline; 
    319319    } 
    320     else if((unsigned short)iStatus == ICQ_STATUS_ONLINE) 
     320    else if(nStatus == ICQ_STATUS_ONLINE) 
    321321    { 
    322322      szTmp = pUser->usprintf(m_szOnlineFormat); 
  • trunk/console/src/window.cpp

    r2721 r3801  
    6767  wbkgd(win, COLOR_PAIR(COLOR_WHITE)); 
    6868  nLastUin = 0; 
     69  sLastContact.szId = 0; 
     70  sLastContact.nPPID = 0; 
    6971  nLastHistory = 1; 
    7072} 
     
    7274CWindow::~CWindow() 
    7375{ 
     76   if (sLastContact.szId) 
     77     free(sLastContact.szId); 
    7478   delwin(win); 
    7579} 
  • trunk/console/src/window.h

    r3768 r3801  
    1515class CLicqConsole; 
    1616class CData; 
     17 
     18struct SContact 
     19{ 
     20  char *szId; 
     21  unsigned long nPPID; 
     22}; 
     23 
    1724 
    1825class CWindow 
     
    4350  CData *data; 
    4451  unsigned long nLastUin; 
    45   //struct SContact sLastContact; 
     52  struct SContact sLastContact; 
    4653  unsigned short nLastHistory; 
    4754protected: