[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-2/konversation/konversation
From:       Shintaro Matsuoka <shin () shoegazed ! org>
Date:       2004-09-04 15:01:58
Message-ID: 20040904150158.2828E1BAF () office ! kde ! org
[Download RAW message or body]

CVS commit by shin: 

enable user to specify his own IP on DCC send and DCC chat


  M +2 -2      prefspagedccsettings.cpp   1.32
  M +24 -10    server.cpp   1.283
  M +2 -2      server.h   1.134


--- kdeextragear-2/konversation/konversation/prefspagedccsettings.cpp  #1.31:1.32
@@ -73,6 +73,6 @@ PrefsPageDccSettings::PrefsPageDccSettin
   dccMethodToGetOwnIpComboBox->insertItem(i18n("Network interface"));
   dccMethodToGetOwnIpComboBox->insertItem(i18n("WHOIS Reply from IRC server"));
-  //dccMethodToGetOwnIpComboBox->insertItem(i18n("001 Reply from IRC server"));
-  //dccMethodToGetOwnIpComboBox->insertItem(i18n("Specify manually"));
+  dccMethodToGetOwnIpComboBox->insertItem(i18n("001 Reply [NOT IMPLEMENTED YET]"));
+  dccMethodToGetOwnIpComboBox->insertItem(i18n("Specify manually"));
   dccMethodToGetOwnIpLabel->setBuddy(dccMethodToGetOwnIpComboBox);
   

--- kdeextragear-2/konversation/konversation/server.cpp  #1.282:1.283
@@ -1137,8 +1137,8 @@ void Server::setDeliberateQuit(bool on)
 }
 
-QString Server::getNumericalIp(bool getFromServer)
+QString Server::getNumericalIp(bool followDccSetting)
 {
   QHostAddress ip;
-  QString sip = getIp(getFromServer);
+  QString sip = getIp(followDccSetting);
   if(sip.isEmpty()) return sip;
   ip.setAddress(sip);
@@ -1299,11 +1299,25 @@ const NickInfoMap* Server::getNicksOnlin
 const NickInfoMap* Server::getNicksOffline() { return &nicknamesOffline; }
 
-QString Server::getIp(bool getFromServer)
+QString Server::getIp(bool followDccSetting)
 {
-  if(getFromServer && !ownIpByServer.isEmpty())
-    return ownIpByServer;
-  // Return our ip using serverSocket
-  kdDebug() << "getIp() returned : " << serverSocket->localAddress().nodeName() << \
                endl;
-  return serverSocket->localAddress().nodeName();
+  QString ip;
+  
+  if(followDccSetting)
+  {
+    int methodId = KonversationApplication::preferences.getDccMethodToGetOwnIp();
+    
+    if(methodId == 1 && !ownIpByServer.isEmpty())  // WHOIS reply
+      ip = ownIpByServer;
+    else if(methodId == 2)  // 001 reply
+      ;  // not implemented yet
+    else if(methodId == 3 && \
!KonversationApplication::preferences.getDccSpecificOwnIp().isEmpty())  // user \
specifies +      ip = KonversationApplication::preferences.getDccSpecificOwnIp();
+  }
+  
+  if(ip.isEmpty())
+    ip = serverSocket->localAddress().nodeName();  // Return our ip using \
serverSocket +  
+  kdDebug() << "getIp() returned : " << ip << endl;
+  return ip;
 }
 
@@ -1491,5 +1505,5 @@ void Server::addDccSend(const QString &r
   emit addDccPanel();
 
-  QString ownIp = getIp(KonversationApplication::preferences.getDccMethodToGetOwnIp()==1);
 +  QString ownIp = getIp(true);
   
   // We already checked that the file exists in output filter / requestDccSend() \
resp. @@ -1559,5 +1573,5 @@ void Server::requestCloseDccPanel()
 void Server::requestDccChat(const QString& nickname)
 {
-  getMainWindow()->addDccChat(getNickname(),nickname,getNumericalIp(KonversationApplication::preferences.getDccMethodToGetOwnIp()==1),QStringList(),true);
 +  getMainWindow()->addDccChat(getNickname(),nickname,getNumericalIp(true),QStringList(),true);
  }
 

--- kdeextragear-2/konversation/konversation/server.h  #1.133:1.134
@@ -147,6 +147,6 @@ class Server : public QObject
 
     bool connected();
-    QString getIp(bool getFromServer = false);
-    QString getNumericalIp(bool getFromServer = false);
+    QString getIp(bool followDccSetting = false);
+    QString getNumericalIp(bool followDccSetting = false);
     bool isNickOnline(const QString &nickname);
     /** Given a nickname, returns NickInfo object.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic