1 /* 2 * Events 3 * ------ 4 * 5 * The library signals everything that happens to the program through 6 * calling the signal listeners that have been connected to the Signal 7 * dispatchers in Client. 8 * 9 * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk> 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2.1 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 26 27 #ifndef EVENTS_H 28 #define EVENTS_H 29 30 #include <time.h> 31 #include <string> 32 33 #include <libicq2000/constants.h> 34 35 #include <libicq2000/ContactList.h> 36 #include <libicq2000/ContactTree.h> 37 38 namespace ICQ2000 { 39 40 class Contact; 41 42 // ============================================================================ 43 // Event Base class 44 // ============================================================================ 45 46 /** 47 * The base class for all events. Basic functionality of all 48 * events is timestamping, so you can tell when an event occurred. 49 */ 50 class Event { 51 protected: 52 /** 53 * the time this event occurred 54 */ 55 time_t m_time; 56 57 public: 58 Event(); 59 Event(time_t t); 60 61 time_t getTime() const; 62 void setTime(time_t t); 63 }; 64 65 // ============================================================================ 66 // SocketEvents 67 // ============================================================================ 68 69 /** 70 * Base class for socket events. 71 */ 72 class SocketEvent : public Event { 73 private: 74 int m_fd; 75 76 public: 77 SocketEvent(int fd); 78 virtual ~SocketEvent(); 79 80 int getSocketHandle() const; 81 82 /** 83 * enum of the different modes of selecting on the socket 84 */ 85 enum Mode { 86 READ = 1 << 0, 87 WRITE = 1 << 1, 88 EXCEPTION = 1 << 2 89 }; 90 }; 91 92 /** 93 * A socket handle add event. This is used by the library to 94 * signal to the client that it should be selecting on this file 95 * descriptor, in the mode(s) described. 96 */ 97 class AddSocketHandleEvent : public SocketEvent { 98 private: 99 Mode m_mode; 100 101 public: 102 AddSocketHandleEvent(int fd, Mode m); 103 104 Mode getMode() const; 105 bool isRead() const; 106 bool isWrite() const; 107 bool isException() const; 108 }; 109 110 /** 111 * A socket handle remove event. This is used by the library to 112 * signal to the client that it should stop selection on this file 113 * descriptor, in any mode. 114 */ 115 class RemoveSocketHandleEvent : public SocketEvent { 116 public: 117 RemoveSocketHandleEvent(int fd); 118 }; 119 120 // ============================================================================ 121 // ConnectingEvent 122 // ============================================================================ 123 124 /** 125 * This event is signalled when the client is connecting to the ICQ network 126 */ 127 class ConnectingEvent : public Event { 128 public: 129 ConnectingEvent(); 130 }; 131 132 // ============================================================================ 133 // ConnectedEvent 134 // ============================================================================ 135 136 /** 137 * This event is signalled when the client is connected properly to 138 * the ICQ network. 139 */ 140 class ConnectedEvent : public Event { 141 public: 142 ConnectedEvent(); 143 }; 144 145 // ============================================================================ 146 // DisconnectedEvent 147 // ============================================================================ 148 149 /** 150 * This event is signalled when the client has been disconnected 151 * from the ICQ network. This may happen even without having a 152 * ConnectedEvent, if for example you password fails at login and you are disconnected. 153 */ 154 class DisconnectedEvent : public Event { 155 public: 156 /** 157 * enum for Reasons for disconnection 158 */ 159 enum Reason { 160 REQUESTED, 161 FAILED_LOWLEVEL, 162 FAILED_BADUSERNAME, 163 FAILED_TURBOING, 164 FAILED_BADPASSWORD, 165 FAILED_MISMATCH_PASSWD, 166 FAILED_DUALLOGIN, 167 FAILED_UNKNOWN 168 }; 169 170 private: 171 Reason m_reason; 172 173 public: 174 DisconnectedEvent(Reason r); 175 176 Reason getReason() const; 177 }; 178 179 // ============================================================================ 180 // LogEvents 181 // ============================================================================ 182 183 /** 184 * This event is for any logging messages generated by the library. 185 */ 186 class LogEvent : public Event { 187 public: 188 /** 189 * enum of different types of log messages 190 */ 191 enum LogType { 192 WARN, 193 ERROR, 194 INFO, 195 PACKET, 196 DIRECTPACKET 197 }; 198 199 private: 200 LogType m_type; 201 std::string m_msg; 202 203 public: 204 LogEvent(LogType type, const std::string& msg); 205 206 LogType getType() const; 207 std::string getMessage() const; 208 }; 209 210 // ============================================================================ 211 // ContactListEvents (user added, user removed, group added, group removed) 212 // ============================================================================ 213 214 /** 215 * Base class for Contact List related events. 216 */ 217 class ContactListEvent : public Event { 218 public: 219 /** 220 * An enum of the different contact list event types. 221 */ 222 enum EventType { 223 UserAdded, 224 UserRemoved, 225 UserRelocated, 226 GroupAdded, 227 GroupRemoved, 228 GroupChange, 229 CompleteUpdate 230 }; 231 232 public: 233 ContactListEvent(); 234 virtual ~ContactListEvent(); 235 236 /** 237 * get the type of ContactListEvent 238 * 239 * @return type of the ContactListEvent 240 */ 241 virtual EventType getType() const = 0; 242 }; 243 244 class UserContactListEvent : public ContactListEvent 245 { 246 private: 247 ContactRef m_contact; 248 ContactTree::Group& m_group; 249 250 public: 251 UserContactListEvent(const ContactRef& c, ContactTree::Group& gp); 252 253 ContactRef getContact() const; 254 ContactTree::Group& get_group(); 255 unsigned int getUIN() const; 256 }; 257 258 /** 259 * The event signalled when a user is added. 260 */ 261 class UserAddedEvent : public UserContactListEvent { 262 public: 263 UserAddedEvent(const ContactRef& c, ContactTree::Group& gp); 264 EventType getType() const; 265 }; 266 267 /** 268 * The event signalled when a user is about to be removed. 269 */ 270 class UserRemovedEvent : public UserContactListEvent { 271 public: 272 UserRemovedEvent(const ContactRef& c, ContactTree::Group& gp); 273 EventType getType() const; 274 }; 275 276 /** 277 * The event signalled when a user is being moved between groups. 278 */ 279 class UserRelocatedEvent : public UserContactListEvent { 280 protected: 281 ContactTree::Group& m_old_group; 282 283 public: 284 UserRelocatedEvent(const ContactRef& c, ContactTree::Group& new_gp, ContactTree::Group& old_gp); 285 EventType getType() const; 286 287 ContactTree::Group& get_old_group(); 288 }; 289 290 /** 291 * Group related ContactList events 292 */ 293 class GroupContactListEvent : public ContactListEvent 294 { 295 private: 296 const ContactTree::Group& m_group; 297 298 public: 299 GroupContactListEvent(const ContactTree::Group& gp); 300 301 const ContactTree::Group& get_group() const; 302 }; 303 304 /** 305 * The event signalled when a group is added. 306 */ 307 class GroupAddedEvent : public GroupContactListEvent 308 { 309 public: 310 GroupAddedEvent(const ContactTree::Group& gp); 311 EventType getType() const; 312 }; 313 314 /** 315 * The event signalled when a group is removed. 316 */ 317 class GroupRemovedEvent : public GroupContactListEvent 318 { 319 public: 320 GroupRemovedEvent(const ContactTree::Group& gp); 321 EventType getType() const; 322 }; 323 324 /** 325 * The event signalled when a group is removed. 326 */ 327 class GroupChangeEvent : public GroupContactListEvent 328 { 329 public: 330 GroupChangeEvent(const ContactTree::Group& gp); 331 EventType getType() const; 332 }; 333 334 /** 335 * The event signalled when the contact list is completely 336 * refreshed (from the server) 337 */ 338 class CompleteUpdateEvent : public ContactListEvent 339 { 340 public: 341 CompleteUpdateEvent(); 342 EventType getType() const; 343 }; 344 345 /* Konst's temporary SBL hack */ 346 347 class SBLReceivedEvent : public Event 348 { 349 public: SBLReceivedEvent(const ContactTree & atree)350 SBLReceivedEvent(const ContactTree &atree): tree(atree) 351 { } 352 353 ContactTree tree; 354 }; 355 356 // ============================================================================ 357 // ContactEvents (status change, user info change) 358 // ============================================================================ 359 360 /** 361 * Base class for Contact events. 362 */ 363 class ContactEvent : public Event { 364 public: 365 /** 366 * An enum of the different contact list event types. 367 */ 368 enum EventType { 369 StatusChange, 370 UserInfoChange, 371 TypingNotification 372 }; 373 374 protected: 375 /** 376 * The contact this event refers to. 377 */ 378 ContactRef m_contact; 379 380 public: 381 ContactEvent(ContactRef c); 382 virtual ~ContactEvent(); 383 384 ContactRef getContact() const; 385 unsigned int getUIN() const; 386 387 /** 388 * get the type of ContactEvent 389 * 390 * @return type of the ContactEvent 391 */ 392 virtual EventType getType() const = 0; 393 }; 394 395 /** 396 * The event signalled when user information changes. 397 */ 398 class UserInfoChangeEvent : public ContactEvent { 399 private: 400 bool m_is_transient_detail; 401 public: 402 UserInfoChangeEvent(ContactRef c, bool is_transient_detail); 403 EventType getType() const; 404 bool isTransientDetail() const; 405 }; 406 407 /** 408 * The event signalled when a user's status changes. 409 */ 410 class StatusChangeEvent : public ContactEvent { 411 private: 412 Status m_status; 413 Status m_old_status; 414 415 public: 416 StatusChangeEvent(ContactRef contact, Status status, Status old_status); 417 418 EventType getType() const; 419 Status getStatus() const; 420 Status getOldStatus() const; 421 }; 422 423 /** 424 * The event signalled when user information changes. 425 */ 426 class UserTypingNotificationEvent : public ContactEvent { 427 private: 428 bool m_typing; 429 public: 430 UserTypingNotificationEvent(ContactRef contact, bool isTyping); 431 EventType getType() const; 432 bool isTyping() const; 433 }; 434 435 436 // ============================================================================ 437 // MessageEvents 438 // ============================================================================ 439 440 /** 441 * A message event. MessageEvents are used for messages, URLs, 442 * SMSs, Authorisation request/responses and away messages. 443 */ 444 class MessageEvent : public Event { 445 public: 446 /** 447 * enum of the type of the message 448 */ 449 enum MessageType { 450 Normal, 451 URL, 452 SMS, 453 SMS_Receipt, 454 AuthReq, 455 AuthAck, 456 AwayMessage, 457 EmailEx, 458 UserAdd, 459 Email, 460 WebPager, 461 FileTransfer, 462 Contacts 463 }; 464 465 enum DeliveryFailureReason { 466 Failed, // general failure 467 Failed_NotConnected, // you are not connected! 468 Failed_ClientNotCapable, // remote client is not capable (away messages) 469 Failed_Denied, // denied outright 470 Failed_Ignored, // ignore completely - send no ACKs back either 471 Failed_Occupied, // resend as to contactlist/urgent 472 Failed_DND, // resend as to contactlist/urgent 473 Failed_SMTP 474 }; 475 476 protected: 477 /// the contact related to the MessageEvent 478 ContactRef m_contact; 479 /// whether the event is finished 480 bool m_finished; 481 /// whether the event was delivered 482 bool m_delivered; 483 /// whether the event was sent direct 484 bool m_direct; 485 486 DeliveryFailureReason m_failure_reason; 487 488 public: 489 MessageEvent(ContactRef c); 490 virtual ~MessageEvent(); 491 492 /** 493 * get the type of the MessageEvent 494 * 495 * @return the type of the message 496 */ 497 virtual MessageType getType() const = 0; 498 ContactRef getContact(); 499 500 bool isFinished() const; 501 bool isDelivered() const; 502 bool isDirect() const; 503 504 void setFinished(bool f); 505 void setDelivered(bool f); 506 void setDirect(bool f); 507 508 DeliveryFailureReason getDeliveryFailureReason() const; 509 void setDeliveryFailureReason(DeliveryFailureReason d); 510 }; 511 512 /** 513 * Base class for ICQ messages (not SMS) 514 */ 515 class ICQMessageEvent : public MessageEvent { 516 private: 517 bool m_urgent, m_tocontactlist, m_offline; 518 std::string m_away_message; 519 520 public: 521 ICQMessageEvent(ContactRef c); 522 523 bool isUrgent() const; 524 void setUrgent(bool b); 525 bool isToContactList() const; 526 void setToContactList(bool b); 527 bool isOfflineMessage() const; 528 void setOfflineMessage(bool b); 529 unsigned int getSenderUIN() const; 530 std::string getAwayMessage() const; 531 void setAwayMessage(const std::string& msg); 532 533 virtual ICQMessageEvent* copy() const = 0; 534 }; 535 536 /** 537 * A normal message 538 */ 539 class NormalMessageEvent : public ICQMessageEvent { 540 private: 541 std::string m_message; 542 bool m_multi; 543 unsigned int m_foreground, m_background; 544 unsigned short m_encoding; 545 546 public: 547 NormalMessageEvent(ContactRef c, const std::string& msg, bool multi = false); 548 NormalMessageEvent(ContactRef c, const std::string& msg, time_t t, bool multi); 549 NormalMessageEvent(ContactRef c, const std::string& msg, unsigned int fg, unsigned int bg); 550 551 std::string getMessage() const; 552 MessageType getType() const; 553 unsigned short getEncoding() const; 554 void setEncoding(const unsigned short encoding); 555 bool isMultiParty() const; 556 unsigned int getForeground() const; 557 unsigned int getBackground() const; 558 void setForeground(unsigned int f); 559 void setBackground(unsigned int b); 560 561 ICQMessageEvent* copy() const; 562 }; 563 564 /** 565 * An URL message 566 */ 567 class URLMessageEvent : public ICQMessageEvent { 568 private: 569 std::string m_message, m_url; 570 571 public: 572 URLMessageEvent(ContactRef c, const std::string& msg, const std::string& url); 573 URLMessageEvent(ContactRef c, const std::string& msg, const std::string& url, time_t t); 574 575 std::string getMessage() const; 576 std::string getURL() const; 577 MessageType getType() const; 578 579 ICQMessageEvent* copy() const; 580 }; 581 582 /** 583 * An SMS message 584 */ 585 class SMSMessageEvent : public MessageEvent { 586 private: 587 std::string m_message, m_source, m_sender, m_senders_network; 588 std::string m_smtp_from, m_smtp_to, m_smtp_subject; 589 bool m_rcpt; 590 591 public: 592 SMSMessageEvent(ContactRef c, const std::string& msg, bool rcpt); 593 SMSMessageEvent(ContactRef c, const std::string& msg, const std::string& source, 594 const std::string& senders_network, const std::string& time); 595 596 std::string getMessage() const; 597 MessageType getType() const; 598 std::string getSource() const; 599 std::string getSender() const; 600 std::string getSenders_network() const; 601 bool getRcpt() const; 602 603 void setSMTPFrom(const std::string& from); 604 std::string getSMTPFrom() const; 605 606 void setSMTPTo(const std::string& to); 607 std::string getSMTPTo() const; 608 609 void setSMTPSubject(const std::string& subj); 610 std::string getSMTPSubject() const; 611 }; 612 613 /** 614 * An SMS (delivery) receipt 615 */ 616 class SMSReceiptEvent : public MessageEvent { 617 private: 618 std::string m_message, m_message_id, m_destination, m_submission_time, m_delivery_time; 619 bool m_delivered; 620 621 public: 622 SMSReceiptEvent(ContactRef c, const std::string& msg, const std::string& message_id, 623 const std::string& submission_time, const std::string& delivery_time, bool del); 624 625 MessageType getType() const; 626 std::string getMessage() const; 627 std::string getMessageId() const; 628 std::string getDestination() const; 629 std::string getSubmissionTime() const; 630 std::string getDeliveryTime() const; 631 bool delivered() const; 632 }; 633 634 /** 635 * An Away message. The way away messages work in ICQ is they are 636 * just sending a special blank message to the other end, and the 637 * away message comes back in the ACK, as it would for other 638 * messages when sent to someone who is away (N/A, etc..). 639 * 640 */ 641 class AwayMessageEvent : public ICQMessageEvent { 642 public: 643 AwayMessageEvent(ContactRef c); 644 645 MessageType getType() const; 646 647 ICQMessageEvent* copy() const; 648 }; 649 650 /** 651 * An Authorisation Request 652 */ 653 class AuthReqEvent : public ICQMessageEvent { 654 private: 655 std::string m_message; 656 657 public: 658 AuthReqEvent(ContactRef c, const std::string& msg); 659 AuthReqEvent(ContactRef c, const std::string& msg, time_t time); 660 661 std::string getMessage() const; 662 MessageType getType() const; 663 664 ICQMessageEvent* copy() const; 665 }; 666 667 /** 668 * An Authorisation Acknowledge (success/failure) 669 */ 670 class AuthAckEvent : public ICQMessageEvent { 671 private: 672 std::string m_message; 673 bool m_granted; 674 675 public: 676 AuthAckEvent(ContactRef c, bool granted); 677 AuthAckEvent(ContactRef c, bool granted, time_t time); 678 AuthAckEvent(ContactRef c, const std::string& msg, bool granted); 679 AuthAckEvent(ContactRef c, const std::string& msg, bool granted, time_t time); 680 681 std::string getMessage() const; 682 MessageType getType() const; 683 bool isGranted() const; 684 685 ICQMessageEvent* copy() const; 686 }; 687 688 /** 689 * An E-mail Express message 690 */ 691 class EmailExEvent : public MessageEvent { 692 private: 693 std::string m_sender, m_email, m_message; 694 695 public: 696 EmailExEvent(ContactRef c, const std::string &email, const std::string &sender, const std::string &msg); 697 698 std::string getMessage() const; 699 std::string getEmail() const; 700 std::string getSender() const; 701 702 MessageType getType() const; 703 unsigned int getSenderUIN() const; 704 }; 705 706 /** 707 * A Web Pager message 708 */ 709 class WebPagerEvent : public MessageEvent { 710 private: 711 std::string m_sender, m_email, m_message; 712 713 public: 714 WebPagerEvent(ContactRef c, const std::string& email, const std::string& sender, const std::string& msg); 715 716 std::string getMessage() const; 717 std::string getEmail() const; 718 std::string getSender() const; 719 720 MessageType getType() const; 721 }; 722 723 /** 724 * A "You were added" message 725 */ 726 class UserAddEvent : public ICQMessageEvent { 727 public: 728 UserAddEvent(ContactRef c); 729 730 MessageType getType() const; 731 unsigned int getSenderUIN() const; 732 733 ICQMessageEvent* copy() const; 734 }; 735 736 /** 737 * An E-mail message, sent with SMTP 738 */ 739 class EmailMessageEvent : public MessageEvent { 740 private: 741 std::string m_message; 742 743 public: 744 EmailMessageEvent(ContactRef c, const std::string &msg); 745 746 std::string getMessage() const; 747 748 MessageType getType() const; 749 }; 750 751 /** 752 * A File Transfer 753 */ 754 class FileTransferEvent : public ICQMessageEvent 755 { 756 public: 757 enum State 758 { 759 NOT_CONNECTED, 760 SEND, 761 RECEIVE, 762 WAIT_RESPONS, 763 ACCEPTED, 764 REJECTED, 765 ERROR, 766 COMPLETE, 767 CANCELLED, 768 TIMEOUT, 769 CLOSE 770 }; 771 772 private: 773 State m_state; 774 775 std::string m_error; 776 std::string m_message, m_description, m_refusal_message, m_save_path; 777 std::list<std::string> m_files; 778 unsigned int m_size, m_speed; 779 unsigned int m_totsize, m_totpos; 780 unsigned int m_pos, m_totfiles, m_currfile; 781 unsigned short m_port; 782 unsigned short m_seqnum; 783 784 public: 785 FileTransferEvent(ContactRef c, const std::string& msg, const std::string& desc, 786 unsigned int size, unsigned short seqnum); 787 788 void setState(State st); 789 State getState(); 790 void setError(const std::string& str); 791 std::string getError(); 792 void addFile(const std::string& file); 793 std::string getFile(); 794 unsigned int getFilesInQueue(); 795 unsigned int getSpeed(); 796 void setSpeed(const unsigned int speed); 797 std::string getMessage() const; 798 std::string getDescription() const; 799 void setDescription(const std::string& str); 800 std::string getSavePath() const; 801 void setSavePath(const std::string& str); 802 803 unsigned int getSize() const; 804 unsigned int getTotalSize() const; 805 unsigned int getTotalPos() const; 806 unsigned int getPos() const; 807 unsigned int getTotalFiles() const; 808 unsigned int getCurrFile() const; 809 810 void setTotalSize(unsigned int t_size); 811 void setSize(unsigned int size); 812 void setPos(unsigned int pos); 813 void setTotalPos(unsigned int pos); 814 void setTotalFiles(unsigned int nr); 815 void setCurrFile(unsigned int pos); 816 817 unsigned short getPort() const; 818 void setPort(unsigned short port); 819 820 std::string getRefusalMessage() const; 821 void setRefusalMessage(const std::string& s); 822 823 unsigned short getSeqNum() const; 824 void setSeqNum(unsigned short seqnum); 825 826 MessageType getType() const; 827 ICQMessageEvent* copy() const; 828 }; 829 830 831 /** 832 * A contacts message 833 */ 834 class ContactMessageEvent : public ICQMessageEvent { 835 private: 836 std::list<ContactRef> m_content; 837 838 public: 839 ContactMessageEvent(ContactRef c, std::list<ContactRef> content); 840 841 MessageType getType() const; 842 unsigned int getSenderUIN() const; 843 844 std::list<ContactRef> getContacts() const; 845 846 ICQMessageEvent* copy() const; 847 }; 848 849 // ============================================================================ 850 // Search Events 851 // ============================================================================ 852 853 /** 854 * The event signalled when a user-search result is received. 855 */ 856 class SearchResultEvent : public Event { 857 public: 858 enum SearchType { 859 ShortWhitepage, 860 FullWhitepage, 861 UIN, 862 Keyword, 863 RandomChat 864 }; 865 866 private: 867 bool m_finished, m_expired; 868 SearchType m_searchtype; 869 ContactList m_clist; 870 ContactRef m_last_contact; 871 unsigned int m_more_results; 872 873 public: 874 SearchResultEvent(SearchType t); 875 876 SearchType getSearchType() const; 877 ContactList& getContactList(); 878 ContactRef getLastContactAdded() const; 879 void setLastContactAdded(ContactRef c); 880 unsigned int getNumberMoreResults() const; 881 882 bool isFinished() const; 883 void setFinished(bool b); 884 bool isExpired() const; 885 void setExpired(bool b); 886 void setNumberMoreResults(unsigned int m); 887 }; 888 889 /** 890 * The event signalled when entries from the server-based contact list is received. 891 */ 892 /* 893 class ServerBasedContactEvent : public Event { 894 public: 895 enum SBLType { 896 Fetch, 897 Upload, 898 Remove 899 }; 900 901 enum UploadResult { 902 Success, 903 Failed, 904 AuthRequired 905 }; 906 907 private: 908 ContactList m_clist; 909 SBLType m_type; 910 std::vector<UploadResult> m_results; 911 912 public: 913 ServerBasedContactEvent(SBLType t, const ContactList& l); 914 915 void setUploadResults(const std::vector<UploadResult> &v); 916 std::map<unsigned int, UploadResult> getUploadResults() const; 917 918 ContactList& getContactList(); 919 SBLType getType() const { return m_type; } 920 }; 921 */ 922 923 // ============================================================================ 924 // NewUINEvent 925 // ============================================================================ 926 927 /** 928 * Registration of a new UIN 929 */ 930 class NewUINEvent : public Event { 931 private: 932 unsigned int m_uin; 933 bool m_success; 934 935 public: 936 NewUINEvent(unsigned int uin, bool success=true); 937 unsigned int getUIN() const; 938 bool isSuccess() const; 939 }; 940 941 /** 942 * Rate Information Changed 943 */ 944 class RateInfoChangeEvent : public Event { 945 public: 946 /** 947 * enum of the rate classes 948 */ 949 enum RateClass { 950 RATE_CHANGE=1, 951 RATE_WARNING, 952 RATE_LIMIT, 953 RATE_LIMIT_CLEARED 954 }; 955 956 private: 957 unsigned short m_code; 958 unsigned short m_rateclass; 959 unsigned int m_windowsize; 960 unsigned int m_clear; 961 unsigned int m_alert; 962 unsigned int m_limit; 963 unsigned int m_disconnect; 964 unsigned int m_currentavg; 965 unsigned int m_maxavg; 966 967 public: 968 RateInfoChangeEvent(unsigned short code, unsigned short rateclass, 969 unsigned int windowsize,unsigned int clear, 970 unsigned int alert,unsigned int limit, 971 unsigned int disconnect,unsigned int currentavg, 972 unsigned int maxavg); 973 974 /// get the code getCode()975 unsigned short getCode() const { return m_code; } 976 /// get the rate class getRateClass()977 unsigned short getRateClass() const { return m_rateclass; } 978 /// get the size of the window getWindowSize()979 unsigned int getWindowSize() const { return m_windowsize; } 980 /// get clear (?) getClear()981 unsigned int getClear() const { return m_clear; } 982 /// get alert (?) getAlert()983 unsigned int getAlert() const { return m_alert; } 984 /// get the limit getLimit()985 unsigned int getLimit() const { return m_limit; } 986 /// get disconnect (?) getDisconnect()987 unsigned int getDisconnect() const { return m_disconnect; } 988 /// get the current average getCurrentAvg()989 unsigned int getCurrentAvg() const { return m_currentavg; } 990 /// get the maximum average getMaxAvg()991 unsigned int getMaxAvg() const { return m_maxavg; } 992 }; 993 994 } 995 996 #endif 997