DCCConnect.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * The contents of this file are subject to the Mozilla Public
  3. * License Version 1.1 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of
  5. * the License at http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS
  8. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. * implied. See the License for the specific language governing
  10. * rights and limitations under the License.
  11. *
  12. * The Original Code is Vision.
  13. *
  14. * The Initial Developer of the Original Code is The Vision Team.
  15. * Portions created by The Vision Team are
  16. * Copyright (C) 1999, 2000, 2001 The Vision Team. All Rights
  17. * Reserved.
  18. *
  19. * Contributor(s): Rene Gollent
  20. * Wade Majors
  21. * Todd Lair
  22. */
  23. #ifndef DCCCONNECT_H_
  24. #define DCCCONNECT_H_
  25. #include <File.h>
  26. #include <String.h>
  27. #include <View.h>
  28. #include <sys/socket.h>
  29. #include <arpa/inet.h>
  30. class BMessenger;
  31. class BStatusBar;
  32. class BStringView;
  33. class StopButton;
  34. class PauseButton;
  35. class DCCConnect : public BView
  36. {
  37. public:
  38. DCCConnect (
  39. const char *,
  40. const char *,
  41. const char *,
  42. const char *,
  43. const char *,
  44. const BMessenger &);
  45. virtual ~DCCConnect (void);
  46. virtual void AttachedToWindow (void);
  47. virtual void AllAttached (void);
  48. virtual void DetachedFromWindow (void);
  49. virtual void Draw (BRect);
  50. virtual void MessageReceived (BMessage *);
  51. static void UpdateBar (const BMessenger &, int, int, uint32, bool);
  52. static void UpdateStatus (const BMessenger &, const char *);
  53. protected:
  54. virtual void Stopped (void);
  55. virtual void Lock (void);
  56. virtual void Unlock (void);
  57. StopButton *fStop;
  58. BMessenger fCaller;
  59. BString fNick,
  60. fFileName,
  61. fSize,
  62. fIp,
  63. fPort;
  64. BStatusBar *fBar;
  65. BStringView *fLabel;
  66. int32 fTotalTransferred;
  67. int32 fFinalRateAverage;
  68. thread_id fTid;
  69. bool fIsStopped;
  70. };
  71. class DCCReceive : public DCCConnect
  72. {
  73. friend class DCCConnect;
  74. public:
  75. DCCReceive (
  76. const char *,
  77. const char *,
  78. const char *,
  79. const char *,
  80. const char *,
  81. const BMessenger &,
  82. bool);
  83. virtual ~DCCReceive (void);
  84. virtual void AttachedToWindow (void);
  85. static int32 Transfer (void *);
  86. protected:
  87. bool fResume;
  88. };
  89. class DCCSend : public DCCConnect
  90. {
  91. friend class DCCConnect;
  92. public:
  93. DCCSend (
  94. const char *,
  95. const char *,
  96. const char *,
  97. const BMessenger &);
  98. virtual ~DCCSend (void);
  99. virtual void AttachedToWindow (void);
  100. static int32 Transfer (void *);
  101. bool IsMatch (const char *, const char *) const;
  102. void SetResume (off_t);
  103. protected:
  104. int64 fPos;
  105. };
  106. #endif