FzApiStructures.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // FileZilla - a Windows ftp client
  2. // Copyright (C) 2002-2004 - Tim Kosse <[email protected]>
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program; if not, write to the Free Software
  13. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. #include "stdafx.h"
  15. #include "FzApiStructures.h"
  16. t_server::t_server()
  17. {
  18. port = 0;
  19. fwbypass = FALSE;
  20. bDontRememberPass = FALSE;
  21. nServerType = 0;
  22. nPasv = 0;
  23. nTimeZoneOffset = 0;
  24. nUTF8 = 0;
  25. iForcePasvIp = -1;
  26. iUseMlsd = -1;
  27. }
  28. t_server::~t_server()
  29. {
  30. }
  31. const bool operator == (const t_server &a,const t_server &b)
  32. {
  33. if (a.host!=b.host)
  34. return false;
  35. if (a.port!=b.port)
  36. return false;
  37. if (a.user!=b.user)
  38. return false;
  39. if (a.account != b.account)
  40. return false;
  41. if (a.pass!=b.pass && a.user!=_MPT("anonymous"))
  42. return false;
  43. if (a.nServerType!=b.nServerType)
  44. return false;
  45. if (a.nPasv != b.nPasv)
  46. return false;
  47. if (a.nTimeZoneOffset != b.nTimeZoneOffset)
  48. return false;
  49. if (a.nUTF8 != b.nUTF8)
  50. return false;
  51. #ifdef MPEXT
  52. if (a.iForcePasvIp != b.iForcePasvIp)
  53. return false;
  54. if (a.iUseMlsd != b.iUseMlsd)
  55. return false;
  56. #endif
  57. return true;
  58. }
  59. const bool operator != (const t_server &a,const t_server &b)
  60. {
  61. return !(a == b);
  62. }
  63. bool t_server::operator<(const t_server &op) const
  64. {
  65. if (host<op.host)
  66. return true;
  67. if (port<op.port)
  68. return true;
  69. if (user<op.user)
  70. return true;
  71. if (account<op.account)
  72. return true;
  73. if (pass<op.pass)
  74. return true;
  75. if (nServerType<op.nServerType)
  76. return true;
  77. if (nPasv < op.nPasv)
  78. return true;
  79. if (nTimeZoneOffset < op.nTimeZoneOffset)
  80. return true;
  81. if (nUTF8 < op.nUTF8)
  82. return true;
  83. #ifdef MPEXT
  84. if (iForcePasvIp < op.iForcePasvIp)
  85. return true;
  86. if (iUseMlsd < op.iUseMlsd)
  87. return true;
  88. #endif
  89. return false;
  90. }