Logo Search packages:      
Sourcecode: nateon version File versions  Download package

void KNateon::dcopCommand ( const QString  s  )  [virtual]

통합메시지함 웹브라우저 설정

받는 사람이 본인이면,

받은 사람이 목록에 없는경우.

받는 사람이 본인이면,

받은 사람이 목록에 없는경우.

받는 사람이 본인이면,

받은 사람이 목록에 없는경우.

받는 사람이 본인이면,

받은 사람이 목록에 없는경우.

1:1 대화

1:n 대화

0 or -xx ???

Implements KNateOnDCOP.

Definition at line 3411 of file knateon.cpp.

References nmconfig::defaultwebbrowser, BuddyList::getBuddyByID(), CurrentAccount::getBuddyList(), CurrentAccount::getMyCyworldID(), CurrentAccount::getMyName(), CurrentAccount::getMyNateID(), BuddyBase::getName(), SQLiteDB::getRecords(), BuddyBase::getUID(), nmconfig::logintype, pSQLiteDB, BuddyBase::setQuit(), slotPopupMemoFromUUID(), slotReplyMemo(), KNateonMainview::slotUpdateMemoCount(), startChat(), and nmconfig::usedefaultwebbrowser.

{
      QStringList slCommand = QStringList::split(QString(":"), s);
      QString sUUID;

      if ( slCommand[0] == "DB" )
      {
            if ( slCommand[1] == "PATH" )
            {
                  DCOPClient *client=kapp->dcopClient();
                  QByteArray params2;
                  QDataStream stream2(params2, IO_WriteOnly);
      
                  if ( stConfig.logintype == 'C' )
                        stream2 << UTF8( locateLocal( "appdata", m_pCurrentAccount->getMyCyworldID(), true ) );
                  else
                        stream2 << UTF8( locateLocal( "appdata", m_pCurrentAccount->getMyNateID(), true ) );
                  if (!client->send("MessageBox-*", "messageviewer", "setDBPath(QString)", params2))
                        kdDebug() << "Error with DCOP\n" ;
            }
            
            /*! 통합메시지함 웹브라우저 설정 */
            DCOPClient *client=kapp->dcopClient();
            QByteArray params2;
            QDataStream stream2(params2, IO_WriteOnly);
            if ( stConfig.usedefaultwebbrowser )
                  stream2 << UTF8( stConfig.defaultwebbrowser );
            else
                  stream2 << UTF8( "none" );
            if (!client->send("MessageBox-*", "messageviewer", "setDefaultBrowser(QString)", params2))
                  kdDebug() << "Error with DCOP\n" << endl;
      }
      else if ( slCommand[0] == "MEMO" )
      {
            if ( slCommand[1] == "NEW")
            {
                  // QString aa("");
                  slotViewMemo( QString::null );
            }
            else if  ( slCommand[1] == "INBOX" )
            {
                  rowList myList;
                  QString sQuery;

                  sUUID = slCommand[3];
                  sQuery = "SELECT SUSER, RUSER, BODYDATA FROM tb_local_inbox WHERE UUID='";
                  sQuery += sUUID;
                  sQuery += "';";
                  myList = pSQLiteDB->getRecords(sMemoDataPath + "local_inbox.db", sQuery);
                  if ( myList.isEmpty() )
                  {
#ifdef NETDEBUG
                        kdDebug() << "[NOTICE] Not Found UUID : [" << s << "]" << endl;
#endif
                        return;
                  }

                  m_pBuddyList = const_cast<BuddyList*>(m_pCurrentAccount->getBuddyList());
      
                  QString sSender;
                  Buddy* pBuddy = m_pBuddyList->getBuddyByID( myList.first()[0] );
                  if ( pBuddy )
                  {
                        sSender = "\"";
                        sSender += pBuddy->getName();
                        sSender += "\" <";
                        sSender += pBuddy->getUID();
                        sSender += ">";
                  }
                  else
                  {
                        sSender = myList.first()[0];
                  }
      
                  QStringList slRecv = QStringList::split(";", myList.first()[1] );
                  QString sReceivers;
                  for ( QStringList::Iterator it = slRecv.begin(); it != slRecv.end(); ++it )
                  {
                        Buddy* pBuddy = m_pBuddyList->getBuddyByID(*it);
                        if ( pBuddy )
                        {
                              if ( sReceivers.length() > 1 )
                                    sReceivers += ";\"" + pBuddy->getName() + "\" <" + *it + ">";
                              else
                                    sReceivers = "\"" + pBuddy->getName() + "\" <" + *it + ">";
                        }
                        else
                        {
                              if ( stConfig.logintype == 'C' )
                              {
                                    /// 받는 사람이 본인이면,
                                    if ( *it == m_pCurrentAccount->getMyCyworldID() )
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                          else
                                                sReceivers = "\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                    }
                                    else /// 받은 사람이 목록에 없는경우.
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";" + *it;
                                          else
                                                sReceivers = *it;
                                    }
                              }
                              else
                              {
                                    /// 받는 사람이 본인이면,
                                    if ( *it == m_pCurrentAccount->getMyNateID() )
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                          else
                                                sReceivers = "\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                    }
                                    else /// 받은 사람이 목록에 없는경우.
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";" + *it;
                                          else
                                                sReceivers = *it;
                                    }
                              }
                        }
                  }
                  QString sMemoBody( myList.first()[2] );

                  if ( slCommand[2] == "REPLY" )
                  {
                        slotReplyMemo( MemoPopupView::Reply, sSender, sMemoBody );
                  }
                  else if ( slCommand[2] == "REPLYALL" )
                  {
                        slotReplyMemo( MemoPopupView::ReplyAll, sSender+";"+sReceivers, sMemoBody );
                  }
                  else if ( slCommand[2] == "FORWARD" )
                  {
                        slotReplyMemo( MemoPopupView::Forward, "", sMemoBody );
                  }
                  else if ( slCommand[2] == "VIEW" )
                  {
                        slotPopupMemoFromUUID( 3, sUUID );
                  }
            }
            else if ( slCommand[1] == "OUTBOX" )
            {
                  rowList myList;
                  QString sQuery;

                  sUUID = slCommand[3];
                  sQuery = "SELECT SUSER, RUSER, BODYDATA FROM tb_local_outbox WHERE UUID='";
                  sQuery += sUUID;
                  sQuery += "';";
                  myList = pSQLiteDB->getRecords(sMemoDataPath + "local_outbox.db", sQuery);
                  if ( myList.isEmpty() )
                  {
#ifdef NETDEBUG
                        kdDebug() << "[NOTICE] Not Found UUID : [" << s << "]" << endl;
#endif
                        return;
                  }

                  m_pBuddyList = const_cast<BuddyList*>(m_pCurrentAccount->getBuddyList());
      
                  QString sSender;
                  Buddy* pBuddy = m_pBuddyList->getBuddyByID( myList.first()[0] );
                  if ( pBuddy )
                  {
                        sSender = "\"";
                        sSender += pBuddy->getName();
                        sSender += "\" <";
                        sSender += pBuddy->getUID();
                        sSender += ">";
                  }
                  else
                  {
                        sSender = myList.first()[0];
                  }
      
                  QStringList slRecv = QStringList::split(";", myList.first()[1] );
                  QString sReceivers;
                  for ( QStringList::Iterator it = slRecv.begin(); it != slRecv.end(); ++it )
                  {
                        Buddy* pBuddy = m_pBuddyList->getBuddyByID(*it);
                        if ( pBuddy )
                        {
                              if ( sReceivers.length() > 1 )
                                    sReceivers += ";\"" + pBuddy->getName() + "\" <" + *it + ">";
                              else
                                    sReceivers = "\"" + pBuddy->getName() + "\" <" + *it + ">";
                        }
                        else
                        {
                              if ( stConfig.logintype == 'C' )
                              {
                                    /// 받는 사람이 본인이면,
                                    if ( *it == m_pCurrentAccount->getMyCyworldID() )
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                          else
                                                sReceivers = "\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                    }
                                    else /// 받은 사람이 목록에 없는경우.
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";" + *it;
                                          else
                                                sReceivers = *it;
                                    }
                              }
                              else
                              {
                                    /// 받는 사람이 본인이면,
                                    if ( *it == m_pCurrentAccount->getMyNateID() )
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                          else
                                                sReceivers = "\"" + m_pCurrentAccount->getMyName() + "\" <" + *it + ">";
                                    }
                                    else /// 받은 사람이 목록에 없는경우.
                                    {
                                          if ( sReceivers.length() > 1 )
                                                sReceivers += ";" + *it;
                                          else
                                                sReceivers = *it;
                                    }
                              }
                        }
                  }
                  QString sMemoBody( myList.first()[2] );

                  if ( slCommand[2] == "REPLY" )
                  {
                        slotReplyMemo( MemoPopupView::Reply, sSender, sMemoBody );
                  }
                  else if ( slCommand[2] == "REPLYALL" )
                  {
                        slotReplyMemo( MemoPopupView::ReplyAll, sSender+";"+sReceivers, sMemoBody );
                  }
                  else if ( slCommand[2] == "FORWARD" )
                  {
                        slotReplyMemo( MemoPopupView::Forward, "", sMemoBody );
                  }
            }
            else if ( slCommand[1] == "COUNT")
            {
                  m_pMainView->slotUpdateMemoCount( slCommand[2].toInt() );
            }
      }
      else if ( slCommand[0] == "CHAT" )
      {
            rowList myList;
            QString sQuery;

            sUUID = slCommand[1];
            sQuery = "SELECT CHATUSERS FROM tb_local_chat WHERE UUID='";
            sQuery += sUUID;
            sQuery += "';";
            myList = pSQLiteDB->getRecords(sChatDataPath + "local_chat.db", sQuery);
            if ( myList.isEmpty() ) {
#ifdef NETDEBUG
                  kdDebug() << "[NOTICE] Not Found UUID : [" << s << "]" << endl;
#endif
                  return;
            }

            QString sChatUsers( myList.first()[0] );

            QStringList slChatUserList = QStringList::split( QString(";"), sChatUsers );

            if ( slChatUserList.count() == 1 ) {
                  /*! 1:1 대화 */
                  Buddy *pBuddy = m_pBuddyList->getBuddyByID( ( slChatUserList[0] ) );
                  if ( pBuddy ) {
                        startChat( pBuddy );
                  }
            } else if ( slChatUserList.count() > 1 ) {
                  /*! 1:n 대화 */
                  QPtrList<Buddy> plBuddies;
                  plBuddies.clear();
                  
                  m_pBuddyList = const_cast<BuddyList*>(m_pCurrentAccount->getBuddyList());
                  for ( QStringList::Iterator it = slChatUserList.begin(); it != slChatUserList.end(); ++it )
                  {
                        *it;
                        Buddy *pBuddy = m_pBuddyList->getBuddyByID( (*it) );
                        if (pBuddy)
                        {
                              pBuddy->setQuit(true);
                              plBuddies.append(pBuddy);
#ifdef NETDEBUG
                              kdDebug() << "[Chatting List] >>> [" << pBuddy->getName() << "]" << endl;
#endif
                        }
                  }
                  if ( plBuddies.count() )
                  {
                        startChat( plBuddies );
                  }
            } else {
                  /*! 0 or -xx ??? */
                  return;
            }
      }
      else if ( slCommand[0] == "CMD" )
      {
            if ( slCommand[1] == "GET" )
            {
                  if ( sDCOPTempCommand.length() > 1 )
                  {
#ifdef NETDEBUG
                        kdDebug() << "XXX [" << sDCOPTempCommand << "]" << endl;
#endif
                        DCOPClient *client=kapp->dcopClient();
                        QByteArray params2;
                        QDataStream stream2(params2, IO_WriteOnly);
                        stream2 << sDCOPTempCommand;
                        if (!client->send("MessageBox-*", "messageviewer", "dcopCommand(QString)", params2))
                              kdDebug() << "Error with DCOP\n" ;
                        sDCOPTempCommand = "";
                  }
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index