Show
Ignore:
Timestamp:
05/06/03 12:43:04 (6 years ago)
Author:
emostar
Message:

Plugin support for sending contacts as a string

Location:
branches/protocol_plugin_1_3_0/qt-gui/src
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • branches/protocol_plugin_1_3_0/qt-gui/src/mmlistview.cpp

    r3472 r3496  
    246246  } 
    247247 
    248   //TODO 
    249   AddUser(text.latin1(), LICQ_PPID); 
     248  //TODO get protocol id from text 
     249  AddUser(text.mid(4, text.length() - 4).latin1(), LICQ_PPID); 
    250250} 
    251251 
  • branches/protocol_plugin_1_3_0/qt-gui/src/mmsenddlg.cpp

    r3472 r3496  
    103103 
    104104 
    105 int CMMSendDlg::go_contact(UinList &_uins) 
     105int CMMSendDlg::go_contact(UserStringList &_users) 
    106106{ 
    107107  m_nEventType = ICQ_CMDxSUB_CONTACTxLIST; 
    108   uins = &_uins; 
     108  users = &_users; 
    109109 
    110110  setCaption(tr("Multiple Recipient Contact List")); 
     
    258258      gUserManager.DropUser(u); 
    259259 
    260       //TODO in the daemon 
    261       icqEventTag = server->icqSendContactList(strtoul(m_szId, (char **)NULL, 0), *uins, 
    262         false, ICQ_TCPxMSG_NORMAL); 
     260      icqEventTag = server->icqSendContactList(m_szId, *users, false, 
     261        ICQ_TCPxMSG_NORMAL); 
    263262      break; 
    264263    } 
  • branches/protocol_plugin_1_3_0/qt-gui/src/mmsenddlg.h

    r3472 r3496  
    3232  int go_message(QString); 
    3333  int go_url(QString, QString); 
    34   //TODO String List please 
    35   int go_contact(UinList &_uins); 
     34  int go_contact(UserStringList &_users); 
    3635protected: 
    3736  QString s1, s2; 
    38   //TODO String list please 
    39   UinList *uins; 
     37  UserStringList *users; 
    4038 
    4139  unsigned long m_nEventType; 
  • branches/protocol_plugin_1_3_0/qt-gui/src/userbox.cpp

    r3491 r3496  
    4949 
    5050#define FLASH_TIME 500 
     51 
     52extern char *PPIDSTRING(unsigned long); 
    5153 
    5254QColor  *CUserViewItem::s_cOnline = NULL, 
     
    10221024        } 
    10231025      } 
    1024       //TODO change this 
    10251026      else if(QTextDrag::decode(e, text)) { 
    1026         unsigned long Uin = text.toULong(); 
    1027  
    1028         if(Uin >= 10000) { 
    1029           if(Uin == it->ItemUin()) return; 
     1027        const char *p = (text.left(4).latin1()); 
     1028        char *szId = strdup((text.mid(4, text.length() - 4).latin1())); 
     1029        unsigned long nPPID = LICQ_PPID; //TODO fix this 
     1030 
     1031        if(szId) { 
     1032          if(strcmp(szId, it->ItemId()) == 0 && nPPID == it->ItemPPID()) return; 
    10301033          UserSendContactEvent* e = static_cast<UserSendContactEvent*> 
    1031             (gMainWindow->callFunction(mnuUserSendContact, it->ItemUin())); 
    1032           ICQUser* u = gUserManager.FetchUser(Uin, LOCK_R); 
     1034            (gMainWindow->callFunction(mnuUserSendContact, it->ItemId(), it->ItemPPID())); 
     1035          ICQUser* u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 
    10331036          QString alias = u ? u->GetAlias() : ""; 
    10341037          gUserManager.DropUser(u); 
    10351038 
    1036           e->setContact(Uin, alias); 
     1039          e->setContact(szId, nPPID, alias); 
    10371040          e->show(); 
    10381041        } 
    10391042        else { 
    10401043          UserSendMsgEvent* e = static_cast<UserSendMsgEvent*> 
    1041             (gMainWindow->callFunction(mnuUserSendMsg, it->ItemUin())); 
     1044            (gMainWindow->callFunction(mnuUserSendMsg, it->ItemId(), it->ItemPPID())); 
    10421045          e->setText(text); 
    10431046          e->show(); 
    10441047        } 
    1045       } 
    1046     } 
    1047     //TODO Change this 
     1048         
     1049        free (szId); 
     1050      } 
     1051    } 
    10481052    else if(it->isGroupItem()) 
    10491053    { 
    10501054      QString text; 
    10511055      if(QTextDrag::decode(e, text)) { 
    1052         unsigned long Uin = text.toULong(); 
    1053         if(Uin >= 10000) { 
    1054           gUserManager.AddUserToGroup(Uin, it->GroupId()); 
     1056        const char *p = (text.left(4).latin1()); 
     1057        char *szId = strdup(text.mid(4, text.length() - 4).latin1()); 
     1058        unsigned long nPPID = LICQ_PPID; //TODO Fix this 
     1059 
     1060        if(szId) { 
     1061          gUserManager.AddUserToGroup(szId, nPPID, it->GroupId()); 
    10551062          gMainWindow->updateUserWin(); 
    10561063        } 
     1064 
     1065        free(szId); 
    10571066      } 
    10581067    } 
     
    13031312 
    13041313  if (parent() && (me->state() & LeftButton) && (i = (CUserViewItem *)currentItem()) 
    1305       && !mousePressPos.isNull() && i->ItemUin() && 
     1314      && !mousePressPos.isNull() && i->ItemId() && 
    13061315      (QPoint(me->pos() - mousePressPos).manhattanLength() > 8)) 
    13071316  { 
    1308     QTextDrag *d = new QTextDrag(QString::number(i->ItemUin()), this); 
     1317    char *p = PPIDSTRING(i->ItemPPID()); 
     1318    QString data(p); 
     1319    data += i->ItemId(); 
     1320    delete [] p; 
     1321    QTextDrag *d = new QTextDrag(data, this); 
    13091322    d->dragCopy(); 
    13101323  } 
  • branches/protocol_plugin_1_3_0/qt-gui/src/usereventdlg.cpp

    r3490 r3496  
    29512951{ 
    29522952  CMMUserViewItem *i = static_cast<CMMUserViewItem*>(lstContacts->firstChild()); 
    2953   UinList uins; 
     2953  UserStringList users; 
    29542954 
    29552955  while (i) 
    29562956  { 
    2957     uins.push_back(i->Uin()); 
     2957    users.push_back(i->Id()); 
    29582958    i = static_cast<CMMUserViewItem *>(i->nextSibling()); 
    29592959  } 
    29602960 
    2961   if (uins.size() == 0) 
     2961  if (users.size() == 0) 
    29622962    return; 
    29632963 
     
    29672967  { 
    29682968    CMMSendDlg *m = new CMMSendDlg(server, sigman, lstMultipleRecipients, this); 
    2969     int r = m->go_contact(uins); 
     2969    int r = m->go_contact(users); 
    29702970    delete m; 
    29712971    if (r != QDialog::Accepted) return; 
     
    29732973 
    29742974  unsigned long icqEventTag; 
    2975   icqEventTag = server->icqSendContactList(m_nUin, uins, 
     2975  icqEventTag = server->icqSendContactList(m_szId, users, 
    29762976    chkSendServer->isChecked() ? false : true, 
    29772977    chkUrgent->isChecked() ? ICQ_TCPxMSG_URGENT : ICQ_TCPxMSG_NORMAL, 
     
    30073007 
    30083008//-----UserSendContactEvent::setContact-------------------------------------- 
    3009 //TODO for new protocol plugin 
    3010 void UserSendContactEvent::setContact(unsigned long Uin, const QString&) 
    3011 { 
    3012   ICQUser* u = gUserManager.FetchUser(Uin, LOCK_R); 
     3009void UserSendContactEvent::setContact(const char *szId, unsigned long nPPID, 
     3010  const QString&) 
     3011{ 
     3012  ICQUser* u = gUserManager.FetchUser(szId, nPPID, LOCK_R); 
    30133013 
    30143014  if(u != NULL) 
  • branches/protocol_plugin_1_3_0/qt-gui/src/usereventdlg.h

    r3472 r3496  
    380380  virtual ~UserSendContactEvent(); 
    381381 
    382   //TODO 
    383   void setContact(unsigned long uin, const QString& alias); 
     382  void setContact(const char *, unsigned long, const QString& alias); 
    384383 
    385384protected: