Yate
yatecbase.h
1 
22 #ifndef __YATECBASE_H
23 #define __YATECBASE_H
24 
25 #ifndef __cplusplus
26 #error C++ is required
27 #endif
28 
29 #include <yatephone.h>
30 
34 namespace TelEngine {
35 
36 class Flags32; // Keeps a 32bit length flag mask
37 class NamedInt; // A named integer value
38 class Window; // A generic window
39 class UIWidget; // A custom widget
40 class UIFactory; // Base factory used to build custom widgets
41 class Client; // The client
42 class ClientChannel; // A client telephony channel
43 class ClientDriver; // The client telephony driver
44 class ClientLogic; // Base class for all client logics
45 class DefaultLogic; // The client's default logic
46 class ClientWizard; // A client wizard
47 class ClientAccount; // A client account
48 class ClientAccountList; // A client account list
49 class ClientContact; // A client contact
50 class ClientResource; // A client contact's resource
51 class MucRoomMember; // A MUC room member
52 class MucRoom; // An account's MUC room contact
53 class DurationUpdate; // Class used to update UI durations
54 class ClientSound; // A sound file
55 class ClientFileItem; // Base class for file/dir items
56 class ClientDir; // A directory
57 class ClientFile; // A file
58 
59 
64 class YATE_API Flags32
65 {
66 public:
70  inline Flags32()
71  : m_flags(0)
72  {}
73 
78  inline Flags32(u_int32_t value)
79  : m_flags(value)
80  {}
81 
86  inline u_int32_t flags() const
87  { return m_flags; }
88 
93  inline void set(u_int32_t mask)
94  { m_flags = m_flags | mask; }
95 
100  inline void reset(u_int32_t mask)
101  { m_flags = m_flags & ~mask; }
102 
108  inline u_int32_t flag(u_int32_t mask) const
109  { return (m_flags & mask); }
110 
116  inline void changeFlag(u_int32_t mask, bool on) {
117  if (on)
118  set(mask);
119  else
120  reset(mask);
121  }
122 
129  inline bool changeFlagCheck(u_int32_t mask, bool ok) {
130  if ((0 != flag(mask)) == ok)
131  return false;
132  changeFlag(mask,ok);
133  return true;
134  }
135 
140  inline void change(u_int32_t value)
141  { m_flags = value; }
142 
146  inline operator u_int32_t() const
147  { return m_flags; }
148 
152  inline const Flags32& operator=(int value)
153  { m_flags = value; return *this; }
154 
155 protected:
156  u_int32_t m_flags;
157 };
158 
163 class YATE_API NamedInt: public String
164 {
166 public:
172  inline NamedInt(const char* name, int val = 0)
173  : String(name), m_value(val)
174  {}
175 
180  inline NamedInt(const NamedInt& other)
181  : String(other), m_value(other.value())
182  {}
183 
188  inline int value() const
189  { return m_value; }
190 
195  inline void setValue(int val)
196  { m_value = val; }
197 
203  static void addToListUniqueName(ObjList& list, NamedInt* obj);
204 
210  static void clearValue(ObjList& list, int val);
211 
219  static inline int lookup(const ObjList& list, const String& name, int defVal = 0) {
220  ObjList* o = list.find(name);
221  return o ? (static_cast<NamedInt*>(o->get()))->value() : defVal;
222  }
223 
231  static inline const String& lookupName(const ObjList& list, int val,
232  const String& defVal = String::empty()) {
233  for (ObjList* o = list.skipNull(); o; o = o->skipNext()) {
234  NamedInt* ni = static_cast<NamedInt*>(o->get());
235  if (ni->value() == val)
236  return *ni;
237  }
238  return defVal;
239  }
240 
241 protected:
242  int m_value;
243 
244 private:
245  NamedInt() {}
246 };
247 
253 class YATE_API Window : public GenObject
254 {
256  friend class Client;
257  YNOCOPY(Window); // no automatic copies please
258 public:
263  explicit Window(const char* id = 0);
264 
268  virtual ~Window();
269 
274  virtual const String& toString() const;
275 
276  /*
277  * Get the window's title (may not be displayed on screen)
278  * @return Title of this window
279  */
280  virtual void title(const String& text);
281 
286  virtual void context(const String& text);
287 
293  virtual bool setParams(const NamedList& params);
294 
299  virtual void setOver(const Window* parent) = 0;
300 
306  virtual bool hasElement(const String& name) = 0;
307 
314  virtual bool setActive(const String& name, bool active) = 0;
315 
322  virtual bool setFocus(const String& name, bool select = false) = 0;
323 
330  virtual bool setShow(const String& name, bool visible) = 0;
331 
339  virtual bool setText(const String& name, const String& text,
340  bool richText = false) = 0;
341 
348  virtual bool setCheck(const String& name, bool checked) = 0;
349 
356  virtual bool setSelect(const String& name, const String& item) = 0;
357 
364  virtual bool setUrgent(const String& name, bool urgent) = 0;
365 
372  virtual bool hasOption(const String& name, const String& item) = 0;
373 
382  virtual bool addOption(const String& name, const String& item, bool atStart = false,
383  const String& text = String::empty()) = 0;
384 
391  virtual bool getOptions(const String& name, NamedList* items) = 0;
392 
399  virtual bool delOption(const String& name, const String& item) = 0;
400 
409  virtual bool addLines(const String& name, const NamedList* lines, unsigned int max,
410  bool atStart = false);
411 
420  virtual bool addTableRow(const String& name, const String& item,
421  const NamedList* data = 0, bool atStart = false);
422 
430  virtual bool setMultipleRows(const String& name, const NamedList& data, const String& prefix = String::empty());
431 
440  virtual bool insertTableRow(const String& name, const String& item,
441  const String& before, const NamedList* data = 0);
442 
449  virtual bool delTableRow(const String& name, const String& item);
450 
458  virtual bool setTableRow(const String& name, const String& item, const NamedList* data);
459 
468  virtual bool updateTableRow(const String& name, const String& item,
469  const NamedList* data = 0, bool atStart = false);
470 
482  virtual bool updateTableRows(const String& name, const NamedList* data,
483  bool atStart = false);
484 
492  virtual bool getTableRow(const String& name, const String& item, NamedList* data = 0);
493 
499  virtual bool clearTable(const String& name);
500 
507  virtual bool setBusy(const String& name, bool on) = 0;
508 
516  virtual bool getText(const String& name, String& text, bool richText = false) = 0;
517 
524  virtual bool getCheck(const String& name, bool& checked) = 0;
525 
532  virtual bool getSelect(const String& name, String& item) = 0;
533 
540  virtual bool getSelect(const String& name, NamedList& items) = 0;
541 
548  virtual bool buildMenu(const NamedList& params) = 0;
549 
556  virtual bool removeMenu(const NamedList& params) = 0;
557 
565  virtual bool setImage(const String& name, const String& image, bool fit = false) = 0;
566 
574  virtual bool setProperty(const String& name, const String& item, const String& value)
575  { return false; }
576 
584  virtual bool getProperty(const String& name, const String& item, String& value)
585  { return false; }
586 
590  inline void populate() {
591  if (m_populated)
592  return;
593  doPopulate();
594  m_populated = true;
595  }
596 
600  inline void init() {
601  if (m_initialized)
602  return;
603  doInit();
604  m_initialized = true;
605  }
606 
610  virtual void show() = 0;
611 
615  virtual void hide() = 0;
616 
622  virtual void size(int width, int height) = 0;
623 
629  virtual void move(int x, int y) = 0;
630 
636  virtual void moveRel(int dx, int dy) = 0;
637 
643  virtual bool related(const Window* wnd) const;
644 
645  virtual void menu(int x, int y) = 0;
646 
651  virtual bool canClose()
652  { return true; }
653 
658  inline const String& id() const
659  { return m_id; }
660 
661  /*
662  * Get the window's title (may not be displayed on screen)
663  * @return Title of this window
664  */
665  inline const String& title() const
666  { return m_title; }
667 
672  inline const String& context() const
673  { return m_context; }
674 
679  inline bool visible() const
680  { return m_visible; }
681 
686  inline void visible(bool yes)
687  { if (yes) show(); else hide(); }
688 
693  inline bool active() const
694  { return m_active; }
695 
700  inline bool master() const
701  { return m_master; }
702 
707  inline bool popup() const
708  { return m_popup; }
709 
718  virtual bool createDialog(const String& name, const String& title,
719  const String& alias = String::empty(), const NamedList* params = 0) = 0;
720 
726  virtual bool closeDialog(const String& name) = 0;
727 
734  static bool isValidParamPrefix(const String& prefix);
735 
736 protected:
737  virtual void doPopulate() = 0;
738  virtual void doInit() = 0;
739 
740  String m_id;
741  String m_title;
742  String m_context;
743  bool m_visible;
744  bool m_active;
745  bool m_master;
746  bool m_popup;
747  bool m_saveOnClose; // Save window's data when destroyed
748 
749 private:
750  bool m_populated; // Already populated flag
751  bool m_initialized; // Already initialized flag
752 };
753 
754 class YATE_API UIWidget : public String
755 {
757  YNOCOPY(UIWidget); // no automatic copies please
758 public:
763  inline explicit UIWidget(const char* name = 0)
764  : String(name)
765  { }
766 
770  virtual ~UIWidget()
771  { }
772 
777  inline const String& name() const
778  { return toString(); }
779 
785  virtual bool setParams(const NamedList& params)
786  { return false; }
787 
793  virtual bool getOptions(NamedList& items)
794  { return false; }
795 
803  virtual bool addTableRow(const String& item, const NamedList* data = 0,
804  bool atStart = false)
805  { return false; }
806 
812  virtual bool setMultipleRows(const NamedList& data, const String& prefix = String::empty())
813  { return false; }
814 
825  virtual bool updateTableRows(const NamedList* data, bool atStart = false)
826  { return false; }
827 
835  virtual bool insertTableRow(const String& item, const String& before,
836  const NamedList* data = 0)
837  { return false; }
838 
844  virtual bool delTableRow(const String& item)
845  { return false; }
846 
853  virtual bool setTableRow(const String& item, const NamedList* data)
854  { return false; }
855 
862  virtual bool getTableRow(const String& item, NamedList* data = 0)
863  { return false; }
864 
869  virtual bool clearTable()
870  { return false; }
871 
877  virtual bool setSelect(const String& item)
878  { return false; }
879 
885  virtual bool getSelect(String& item)
886  { return false; }
887 
893  virtual bool getSelect(NamedList& items)
894  { return false; }
895 
903  virtual bool addLines(const NamedList& lines, unsigned int max, bool atStart = false)
904  { return false; }
905 
912  virtual bool setText(const String& text, bool richText = false)
913  { return false; }
914 
921  virtual bool getText(String& text, bool richText = false)
922  { return false; }
923 
929  virtual bool setBusy(bool on)
930  { return false; }
931 };
932 
938 class YATE_API UIFactory : public String
939 {
941  YNOCOPY(UIFactory); // no automatic copies please
942 public:
946  explicit UIFactory(const char* name);
947 
951  virtual ~UIFactory();
952 
958  inline bool canBuild(const String& type)
959  { return 0 != m_types.find(type); }
960 
968  virtual void* create(const String& type, const char* name, NamedList* params = 0) = 0;
969 
979  static void* build(const String& type, const char* name, NamedList* params = 0,
980  const char* factory = 0);
981 
982 protected:
983  ObjList m_types; // List of object types this factory can build
984 
985 private:
986  static ObjList s_factories; // Registered factories list
987 };
988 
993 class YATE_API Client : public MessageReceiver
994 {
996  friend class Window;
997  friend class ClientChannel;
998  friend class ClientDriver;
999  friend class ClientLogic;
1000 public:
1004  enum MsgID {
1005  CallCdr = 0,
1006  UiAction,
1007  UserLogin,
1008  UserNotify,
1009  ResourceNotify,
1010  ResourceSubscribe,
1011  ClientChanUpdate,
1012  UserRoster,
1013  ContactInfo,
1014  // Handlers not automatically installed
1015  ChanNotify,
1016  MucRoom,
1017  // IDs used only to postpone messages
1018  MsgExecute,
1019  EngineStart,
1020  TransferNotify,
1021  UserData,
1022  FileInfo,
1023  // Starting value for custom relays
1024  MsgIdCount
1025  };
1026 
1031  OptMultiLines = 0, // Accept incoming calls
1032  OptAutoAnswer, // Auto answer incoming calls
1033  OptRingIn, // Enable/disable incoming ringer
1034  OptRingOut, // Enable/disable outgoing ringer
1035  OptActivateLastOutCall, // Set the last outgoing call active
1036  OptActivateLastInCall, // Set the last incoming call active
1037  OptActivateCallOnSelect, // Set the active call when selected in channel
1038  // list (don't require double click)
1039  OptKeypadVisible, // Show/hide keypad
1040  OptOpenIncomingUrl, // Open an incoming URL in call.execute message
1041  OptAddAccountOnStartup, // Open account add window on startup
1042  OptDockedChat, // Show all contacts chat in the same window
1043  OptDestroyChat, // Destroy contact chat when contact is removed/destroyed
1044  OptNotifyChatState, // Notify chat states
1045  OptShowEmptyChat, // Display received empty chat in chat history
1046  OptSendEmptyChat, // Send empty chat
1047  OptCount
1048  };
1049 
1054  TrayIconMain = 0,
1055  TrayIconInfo = 1000,
1056  TrayIconIncomingChat = 3000,
1057  TrayIconNotification = 5000,
1058  TrayIconIncomingCall = 10000,
1059  };
1060 
1065  explicit Client(const char *name = 0);
1066 
1070  virtual ~Client();
1071 
1076  virtual bool startup();
1077 
1081  virtual void run();
1082 
1086  virtual void cleanup();
1087 
1091  virtual void main() = 0;
1092 
1096  virtual void lock() = 0;
1097 
1101  virtual void unlock() = 0;
1102 
1106  inline void lockOther()
1107  { if (!m_oneThread) lock(); }
1108 
1112  inline void unlockOther()
1113  { if (!m_oneThread) unlock(); }
1114 
1119  inline void setThread(Thread* th)
1120  { m_clientThread = th; }
1121 
1125  virtual void allHidden() = 0;
1126 
1132  void loadUI(const char* file = 0, bool init = true);
1133 
1137  virtual void quit() = 0;
1138 
1144  bool openUrlSafe(const String& url);
1145 
1151  virtual bool openUrl(const String& url) = 0;
1152 
1159  virtual bool received(Message& msg, int id);
1160 
1168  virtual bool createWindowSafe(const String& name,
1169  const String& alias = String::empty());
1170 
1180  virtual bool createDialog(const String& name, Window* parent, const String& title,
1181  const String& alias = String::empty(), const NamedList* params = 0);
1182 
1191  virtual bool createObject(void** dest, const String& type, const char* name,
1192  NamedList* params = 0);
1193 
1200  virtual bool closeWindow(const String& name, bool hide = true);
1201 
1209  virtual bool closeDialog(const String& name, Window* wnd, Window* skip = 0);
1210 
1216  virtual bool debugHook(bool active);
1217 
1223  virtual bool addToLog(const String& text);
1224 
1231  virtual bool setStatus(const String& text, Window* wnd = 0);
1232 
1239  bool setStatusLocked(const String& text, Window* wnd = 0);
1240 
1248  bool setParams(const NamedList* params, Window* wnd = 0, Window* skip = 0);
1249 
1258  virtual bool action(Window* wnd, const String& name, NamedList* params = 0);
1259 
1268  virtual bool toggle(Window* wnd, const String& name, bool active);
1269 
1279  virtual bool select(Window* wnd, const String& name, const String& item, const String& text = String::empty());
1280 
1289  virtual bool select(Window* wnd, const String& name, const NamedList& items);
1290 
1295  inline bool oneThread() const
1296  { return m_oneThread; }
1297 
1302  inline int line() const
1303  { return m_line; }
1304 
1309  void line(int newLine);
1310 
1311  bool hasElement(const String& name, Window* wnd = 0, Window* skip = 0);
1312  bool setActive(const String& name, bool active, Window* wnd = 0, Window* skip = 0);
1313  bool setFocus(const String& name, bool select = false, Window* wnd = 0, Window* skip = 0);
1314  bool setShow(const String& name, bool visible, Window* wnd = 0, Window* skip = 0);
1315  bool setText(const String& name, const String& text, bool richText = false,
1316  Window* wnd = 0, Window* skip = 0);
1317  bool setCheck(const String& name, bool checked, Window* wnd = 0, Window* skip = 0);
1318  bool setSelect(const String& name, const String& item, Window* wnd = 0, Window* skip = 0);
1319  bool setUrgent(const String& name, bool urgent, Window* wnd = 0, Window* skip = 0);
1320  bool hasOption(const String& name, const String& item, Window* wnd = 0, Window* skip = 0);
1321 
1330  virtual bool getOptions(const String& name, NamedList* items,
1331  Window* wnd = 0, Window* skip = 0);
1332 
1333  bool addOption(const String& name, const String& item, bool atStart,
1334  const String& text = String::empty(), Window* wnd = 0, Window* skip = 0);
1335  bool delOption(const String& name, const String& item, Window* wnd = 0, Window* skip = 0);
1336 
1347  bool addLines(const String& name, const NamedList* lines, unsigned int max,
1348  bool atStart = false, Window* wnd = 0, Window* skip = 0);
1349 
1350  bool addTableRow(const String& name, const String& item, const NamedList* data = 0,
1351  bool atStart = false, Window* wnd = 0, Window* skip = 0);
1352 
1362  bool setMultipleRows(const String& name, const NamedList& data, const String& prefix = String::empty(), Window* wnd = 0, Window* skip = 0);
1363 
1374  bool insertTableRow(const String& name, const String& item,
1375  const String& before, const NamedList* data = 0,
1376  Window* wnd = 0, Window* skip = 0);
1377 
1378  bool delTableRow(const String& name, const String& item, Window* wnd = 0, Window* skip = 0);
1379  bool setTableRow(const String& name, const String& item, const NamedList* data,
1380  Window* wnd = 0, Window* skip = 0);
1381  bool getTableRow(const String& name, const String& item, NamedList* data = 0,
1382  Window* wnd = 0, Window* skip = 0);
1383  bool clearTable(const String& name, Window* wnd = 0, Window* skip = 0);
1384 
1395  bool updateTableRow(const String& name, const String& item, const NamedList* data = 0,
1396  bool atStart = false, Window* wnd = 0, Window* skip = 0);
1397 
1411  bool updateTableRows(const String& name, const NamedList* data, bool atStart = false,
1412  Window* wnd = 0, Window* skip = 0);
1413 
1422  bool setBusy(const String& name, bool on, Window* wnd = 0, Window* skip = 0);
1423 
1433  bool getText(const String& name, String& text, bool richText = false, Window* wnd = 0, Window* skip = 0);
1434 
1435  bool getCheck(const String& name, bool& checked, Window* wnd = 0, Window* skip = 0);
1436  bool getSelect(const String& name, String& item, Window* wnd = 0, Window* skip = 0);
1437 
1446  bool getSelect(const String& name, NamedList& items, Window* wnd = 0, Window* skip = 0);
1447 
1472  bool buildMenu(const NamedList& params, Window* wnd = 0, Window* skip = 0);
1473 
1484  bool removeMenu(const NamedList& params, Window* wnd = 0, Window* skip = 0);
1485 
1494  virtual bool setImage(const String& name, const String& image,
1495  Window* wnd = 0, Window* skip = 0);
1496 
1505  virtual bool setImageFit(const String& name, const String& image,
1506  Window* wnd = 0, Window* skip = 0);
1507 
1517  virtual bool setProperty(const String& name, const String& item, const String& value,
1518  Window* wnd = 0, Window* skip = 0);
1519 
1529  virtual bool getProperty(const String& name, const String& item, String& value,
1530  Window* wnd = 0, Window* skip = 0);
1531 
1532  void moveRelated(const Window* wnd, int dx, int dy);
1533  inline bool initialized() const
1534  { return m_initialized; }
1535  inline static Client* self()
1536  { return s_client; }
1537  inline static void setSelf(Client* client)
1538  { s_client = client; }
1539 
1544  static inline bool valid()
1545  { return self() && (self()->isUIThread() || !(exiting() || Engine::exiting())); }
1546 
1552  static bool isClientMsg(Message& msg);
1553 
1554  inline static bool changing()
1555  { return (s_changing > 0); }
1556  static Window* getWindow(const String& name);
1557  static bool setVisible(const String& name, bool show = true, bool activate = false);
1558  static bool getVisible(const String& name);
1559  static bool openPopup(const String& name, const NamedList* params = 0, const Window* parent = 0);
1560  static bool openMessage(const char* text, const Window* parent = 0, const char* context = 0);
1561  static bool openConfirm(const char* text, const Window* parent = 0, const char* context = 0);
1562  static ObjList* listWindows();
1563  void idleActions();
1564 
1572  bool postpone(const Message& msg, int id, bool copyUserData = false);
1573 
1582  virtual bool chooseFile(Window* parent, NamedList& params)
1583  { return false; }
1584 
1595  virtual bool setClientParam(const String& param, const String& value,
1596  bool save, bool update);
1597 
1604  virtual bool backspace(const String& name, Window* wnd = 0);
1605 
1613  void installRelay(const char* name, int id, int prio);
1614 
1619  virtual bool callRouting(Message& msg)
1620  { return true;}
1621 
1626  virtual bool imRouting(Message& msg)
1627  { return true;}
1628 
1633  virtual bool imExecute(Message& msg);
1634 
1645  virtual bool buildIncomingChannel(Message& msg, const String& dest);
1646 
1652  virtual bool buildOutgoingChannel(NamedList& params);
1653 
1661  bool callIncoming(Message& msg, const String& dest);
1662 
1669  void callAnswer(const String& id, bool setActive = true);
1670 
1678  void callTerminate(const String& id, const char* reason = 0, const char* error = 0);
1679 
1684  ClientChannel* getActiveChannel();
1685 
1693  virtual bool ringer(bool in, bool on);
1694 
1702  virtual bool createSound(const char* name, const char* file, const char* device = 0)
1703  { return false; }
1704 
1711  bool emitDigits(const char* digits, const String& id = String::empty());
1712 
1719  inline bool emitDigit(char digit, const String& id = String::empty()) {
1720  char s[2] = {digit,0};
1721  return emitDigits(s,id);
1722  }
1723 
1729  inline bool getBoolOpt(ClientToggle toggle)
1730  { return toggle < OptCount ? m_toggles[toggle] : false; }
1731 
1739  bool setBoolOpt(ClientToggle toggle, bool value, bool updateUi = false);
1740 
1749  virtual bool formatDateTime(String& dest, unsigned int secs, const char* format,
1750  bool utc = false)
1751  { return false; }
1752 
1757  static inline bool exiting()
1758  { return s_exiting; }
1759 
1765  static bool getActive(const String& name);
1766 
1775  static Message* buildMessage(const char* msg, const String& account,
1776  const char* oper = 0);
1777 
1785  static Message* buildNotify(bool online, const String& account,
1786  const ClientResource* from = 0);
1787 
1798  static Message* buildSubscribe(bool request, bool ok, const String& account,
1799  const String& contact, const char* proto = 0);
1800 
1809  static Message* buildUserRoster(bool update, const String& account,
1810  const String& contact, const char* proto = 0);
1811 
1817  static bool addLogic(ClientLogic* logic);
1818 
1823  static void removeLogic(ClientLogic* logic);
1824 
1830  static ClientLogic* findLogic(const String& name);
1831 
1840  static Message* eventMessage(const String& event, Window* wnd = 0,
1841  const char* name = 0, NamedList* params = 0);
1842 
1850  static bool save(Configuration& cfg, Window* parent = 0, bool showErr = true);
1851 
1857  static ClientToggle getBoolOpt(const String& name);
1858 
1862  static inline void setLogicsTick()
1863  { s_idleLogicsTick = true; }
1864 
1872  static void appendEscape(String& buf, ObjList& list, char sep = ',', bool force = false);
1873 
1881  static ObjList* splitUnescape(const String& buf, char sep = ',', bool emptyOk = false);
1882 
1888  static void removeChars(String& buf, const char* chars);
1889 
1898  static void fixPhoneNumber(String& number, const char* chars = 0);
1899 
1909  static bool addTrayIcon(const String& wndName, int prio, NamedList* params);
1910 
1919  static bool removeTrayIcon(const String& wndName, const String& name);
1920 
1928  static bool updateTrayIcon(const String& wndName);
1929 
1935  static void generateGuid(String& buf, const String& extra = String::empty());
1936 
1942  static void plain2html(String& buf, bool spaceEol = false);
1943 
1951  static NamedString* findParamByValue(NamedList& list, const String& value,
1952  NamedString* skip = 0);
1953 
1962  static int decodeFlags(const TokenDict* dict, const NamedList& params,
1963  const String& prefix = String::empty());
1964 
1973  static int decodeFlags(const TokenDict* dict, const String& flags, int defVal = 0);
1974 
1982  static void addPathSep(String& dest, const String& path, char sep = 0);
1983 
1988  static void fixPathSep(String& path);
1989 
1998  static bool removeEndsWithPathSep(String& dest, const String& path, char sep = 0);
1999 
2008  static bool getLastNameInPath(String& dest, const String& path, char sep = 0);
2009 
2022  static bool removeLastNameInPath(String& dest, const String& path, char sep = 0,
2023  const String& equalOnly = String::empty());
2024 
2030  static bool addToLogFormatted(const char* format, ...);
2031 
2032  static Configuration s_settings; // Client settings
2033  static Configuration s_actions; // Logic preferrences
2034  static Configuration s_accounts; // Accounts
2035  static Configuration s_contacts; // Contacts
2036  static Configuration s_providers; // Provider settings
2037  static Configuration s_history; // Call log
2038  static Configuration s_calltoHistory; // Dialed destinations history
2039  // Holds a not selected/set value match
2040  static Regexp s_notSelected;
2041  // Regexp used to check if a string is a GUID in the format
2042  // 8*HEX-4*HEX-4*HEX-4*HEX-12*HEX
2043  static Regexp s_guidRegexp;
2044  // Paths
2045  static String s_skinPath;
2046  static String s_soundPath;
2047  // Ring name for incoming channels
2048  static String s_ringInName;
2049  // Ring name for outgoing channels
2050  static String s_ringOutName;
2051  // Status widget's name
2052  static String s_statusWidget;
2053  // Widget displaying the debug text
2054  static String s_debugWidget;
2055  // The list of cient's toggles
2056  static String s_toggles[OptCount];
2057  // Maximum remote users allowed to enter in conference
2058  static int s_maxConfPeers;
2059  // Engine started flag
2060  static bool s_engineStarted;
2061 
2062 protected:
2068  virtual ClientLogic* createDefaultLogic();
2069  virtual bool createWindow(const String& name,
2070  const String& alias = String::empty()) = 0;
2071  virtual void loadWindows(const char* file = 0) = 0;
2072  virtual void initWindows();
2073  virtual void initClient();
2074  virtual void exitClient()
2075  {}
2076  virtual bool isUIThread()
2077  { return Thread::current() == m_clientThread; }
2078  inline bool needProxy() const
2079  { return m_oneThread && !(Client::self() && Client::self()->isUIThread()); }
2080  bool driverLockLoop();
2081  static bool driverLock(long maxwait = 0);
2082  static void driverUnlock();
2083 
2084  static bool s_exiting; // Exiting flag
2085 
2086  ObjList m_windows;
2087  bool m_initialized;
2088  int m_line;
2089  bool m_oneThread;
2090  bool m_toggles[OptCount];
2091  ObjList m_relays; // Message relays installed by this receiver
2092  ClientLogic* m_defaultLogic; // The default logic
2093  static Client* s_client;
2094  static int s_changing;
2095  static ObjList s_logics;
2096  static bool s_idleLogicsTick; // Call logics' timerTick()
2097  Thread* m_clientThread;
2098 };
2099 
2104 class YATE_API ClientChannel : public Channel
2105 {
2107  friend class ClientDriver;
2108  YNOCOPY(ClientChannel); // no automatic copies please
2109 public:
2114  Startup,
2115  Destroyed,
2116  Active,
2117  OnHold,
2118  Mute,
2119  Noticed,
2120  AddrChanged,
2121  Routed,
2122  Accepted,
2123  Rejected,
2124  Progressing,
2125  Ringing,
2126  Answered,
2127  Transfer,
2128  Conference,
2129  AudioSet,
2130  Unknown
2131  };
2132 
2136  enum SlaveType {
2137  SlaveNone = 0,
2138  SlaveTransfer,
2139  SlaveConference,
2140  };
2141 
2147  ClientChannel(const Message& msg, const String& peerid);
2148 
2156  ClientChannel(const String& target, const NamedList& params, int st = SlaveNone,
2157  const String& masterChan = String::empty());
2158 
2163  explicit ClientChannel(const String& soundId);
2164 
2165  virtual ~ClientChannel();
2166 
2173  bool start(const String& target, const NamedList& params);
2174 
2175  virtual bool msgProgress(Message& msg);
2176  virtual bool msgRinging(Message& msg);
2177  virtual bool msgAnswered(Message& msg);
2178  virtual bool msgDrop(Message& msg, const char* reason);
2179  virtual bool callRouted(Message& msg);
2180  virtual void callAccept(Message& msg);
2181  virtual void callRejected(const char* error, const char* reason, const Message* msg);
2182 
2187  void callAnswer(bool setActive = true);
2188 
2193  inline int slave() const
2194  { return m_slave; }
2195 
2201  inline ObjList& slaves()
2202  { return m_slaves; }
2203 
2208  inline unsigned int slavesCount() const {
2209  Lock lock(m_mutex);
2210  return m_slaves.count();
2211  }
2212 
2217  inline void addSlave(const String& sid) {
2218  Lock lock(m_mutex);
2219  if (!m_slaves.find(sid))
2220  m_slaves.append(new String(sid));
2221  }
2222 
2227  inline void removeSlave(const String& sid) {
2228  Lock lock(m_mutex);
2229  m_slaves.remove(sid);
2230  }
2231 
2236  inline const String& master() const
2237  { return m_master; }
2238 
2243  inline const NamedList& clientParams() const
2244  { return m_clientParams; }
2245 
2250  inline const String& party() const
2251  { return m_party; }
2252 
2257  inline const String& partyName() const
2258  { return m_partyName ? m_partyName : m_party; }
2259 
2264  inline bool conference() const
2265  { return m_conference; }
2266 
2271  inline const String& transferId() const
2272  { return m_transferId; }
2273 
2278  inline RefObject* clientData() const
2279  { return m_clientData; }
2280 
2286  inline void setClientData(RefObject* obj = 0) {
2287  TelEngine::destruct(m_clientData);
2288  if (obj && obj->ref())
2289  m_clientData = obj;
2290  }
2291 
2298  bool setMedia(bool open = false, bool replace = false);
2299 
2306  bool setActive(bool active, bool update = true);
2307 
2314  bool setMuted(bool on, bool update = true);
2315 
2321  void setTransfer(const String& target = String::empty());
2322 
2328  void setConference(const String& target = String::empty());
2329 
2334  inline const String& peerOutFormat() const
2335  { return m_peerOutFormat; }
2336 
2341  inline const String& peerInFormat() const
2342  { return m_peerInFormat; }
2343 
2348  inline bool active() const
2349  { return m_active; }
2350 
2355  inline bool muted() const
2356  { return m_muted; }
2357 
2362  inline bool isNoticed() const
2363  { return m_noticed; }
2364 
2368  void noticed();
2369 
2374  inline int line() const
2375  { return m_line; }
2376 
2381  void line(int newLine);
2382 
2393  void update(int notif, bool chan = true,
2394  bool updatePeer = true, const char* engineMsg = 0,
2395  bool minimal = false, bool data = false);
2396 
2401  inline void getReconnPeer(String& buf) {
2402  Lock lck(m_mutex);
2403  buf = m_peerId;
2404  }
2409  inline bool hasReconnPeer()
2410  { return 0 != getReconnPeer(false); }
2411 
2417  CallEndpoint* getReconnPeer(bool ref = true);
2418 
2422  void dropReconnPeer(const char* reason = 0);
2423 
2430  static int lookup(const char* notif, int def = Unknown)
2431  { return TelEngine::lookup(notif,s_notification,def); }
2432 
2439  static const char* lookup(int notif, const char* def = 0)
2440  { return TelEngine::lookup(notif,s_notification,def); }
2441 
2448  static int lookupSlaveType(const char* notif, int def = SlaveNone)
2449  { return TelEngine::lookup(notif,s_slaveTypes,def); }
2450 
2454  static const TokenDict s_notification[];
2455 
2459  static const TokenDict s_slaveTypes[];
2460 
2461 protected:
2462  virtual void destroyed();
2463  virtual void connected(const char* reason);
2464  virtual void disconnected(bool final, const char* reason);
2465  // Check for a source in channel's peer or a received message's user data
2466  inline bool peerHasSource(Message& msg) {
2467  CallEndpoint* ch = getPeer();
2468  if (!ch)
2469  ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
2470  return ch && ch->getSource();
2471  }
2472  // Check if our consumer's source sent any data
2473  // Don't set the silence flag is already reset
2474  void checkSilence();
2475 
2476  int m_slave; // Slave type
2477  String m_master; // Master channel id
2478  String m_party; // Remote party
2479  String m_partyName; // Remote party name
2480  String m_peerOutFormat; // Peer consumer's data format
2481  String m_peerInFormat; // Peer source's data format
2482  String m_reason; // Termination reason
2483  String m_peerId; // Peer's id (used to re-connect)
2484  bool m_noticed; // Incoming channel noticed flag
2485  int m_line; // Channel's line (address)
2486  bool m_active; // Channel active flag
2487  bool m_silence; // True if the peer did't sent us any audio data
2488  bool m_conference; // True if this channel is in conference
2489  bool m_muted; // True if this channel is muted (no data source))
2490  String m_transferId; // Transferred id or empty if not transferred
2491  RefObject* m_clientData; // Obscure data used by client logics
2492  bool m_utility; // Regular client channel flag
2493  String m_soundId; // The id of the sound to play
2494  ObjList m_slaves; // Data managed by the default logic
2495  NamedList m_clientParams; // Channel client parameters
2496 };
2497 
2502 class YATE_API ClientDriver : public Driver
2503 {
2505  friend class ClientChannel; // Reset active channel's id
2506  YNOCOPY(ClientDriver); // No automatic copies please
2507 public:
2508  ClientDriver();
2509  virtual ~ClientDriver();
2510  virtual void initialize() = 0;
2511  virtual bool msgExecute(Message& msg, String& dest);
2512  virtual void msgTimer(Message& msg);
2513  virtual bool msgRoute(Message& msg);
2514  virtual bool received(Message& msg, int id);
2515 
2520  inline const String& activeId() const
2521  { return m_activeId; }
2522 
2531  bool setActive(const String& id = String::empty());
2532 
2538  ClientChannel* findLine(int line);
2539 
2544  inline static ClientDriver* self()
2545  { return s_driver; }
2546 
2551  inline static const String& device()
2552  { return s_device; }
2553 
2558  static void dropCalls(const char* reason = 0);
2559 
2566  static bool setAudioTransfer(const String& id, const String& target = String::empty());
2567 
2577  static bool setConference(const String& id, bool in, const String* confName = 0,
2578  bool buildFromChan = false);
2579 
2585  static ClientChannel* findChan(const String& id);
2586 
2592  static ClientChannel* findChanByPeer(const String& peer);
2593 
2599  { return self() ? findChan(self()->activeId()) : 0; }
2600 
2607  static void dropChan(const String& chan, const char* reason = 0, bool peer = false);
2608 
2613 
2618  static bool s_dropConfPeer;
2619 
2620 protected:
2621  void setup();
2622  static ClientDriver* s_driver;
2623  static String s_device;
2624  String m_activeId; // The active channel's id
2625 };
2626 
2633 class YATE_API ClientLogic : public GenObject
2634 {
2636  friend class Client;
2637  YNOCOPY(ClientLogic); // no automatic copies please
2638 public:
2642  virtual ~ClientLogic();
2643 
2648  inline const String& name() const
2649  { return m_name; }
2650 
2655  inline int priority() const
2656  { return m_prio; }
2657 
2662  virtual const String& toString() const;
2663 
2669  bool setParams(const NamedList& params);
2670 
2678  virtual bool action(Window* wnd, const String& name, NamedList* params = 0)
2679  { return false; }
2680 
2688  virtual bool toggle(Window* wnd, const String& name, bool active)
2689  { return false; }
2690 
2699  virtual bool select(Window* wnd, const String& name, const String& item,
2700  const String& text = String::empty())
2701  { return false; }
2702 
2710  virtual bool select(Window* wnd, const String& name, const NamedList& items)
2711  { return false; }
2712 
2721  virtual bool setClientParam(const String& param, const String& value,
2722  bool save, bool update)
2723  { return false; }
2724 
2729  virtual bool imIncoming(Message& msg)
2730  { return false; }
2731 
2739  virtual bool callIncoming(Message& msg, const String& dest)
2740  { return false; }
2741 
2748  virtual bool validateCall(NamedList& params, Window* wnd = 0)
2749  { return true; }
2750 
2759  virtual bool callStart(NamedList& params, Window* wnd = 0,
2760  const String& cmd = String::empty())
2761  { return false; }
2762 
2769  virtual bool line(const String& name, Window* wnd = 0);
2770 
2778  virtual bool display(NamedList& params, bool widget, Window* wnd = 0);
2779 
2786  virtual bool backspace(const String& name, Window* wnd = 0);
2787 
2794  virtual bool command(const String& name, Window* wnd = 0);
2795 
2806  virtual bool debug(const String& name, bool active, Window* wnd = 0);
2807 
2815  virtual bool editAccount(bool newAcc, NamedList* params, Window* wnd = 0)
2816  { return false; }
2817 
2824  virtual bool acceptAccount(NamedList* params, Window* wnd = 0)
2825  { return false; }
2826 
2833  virtual bool delAccount(const String& account, Window* wnd = 0)
2834  { return false; }
2835 
2843  virtual bool updateAccount(const NamedList& account, bool login, bool save)
2844  { return false; }
2845 
2852  virtual bool loginAccount(const NamedList& account, bool login)
2853  { return false; }
2854 
2863  virtual bool updateContact(const NamedList& contact, bool save, bool update)
2864  { return false; }
2865 
2872  virtual bool acceptContact(NamedList* params, Window* wnd = 0)
2873  { return false; }
2874 
2882  virtual bool editContact(bool newCont, NamedList* params = 0, Window* wnd = 0)
2883  { return false; }
2884 
2891  virtual bool delContact(const String& contact, Window* wnd = 0)
2892  { return false; }
2893 
2900  virtual bool callContact(NamedList* params = 0, Window* wnd = 0)
2901  { return false; }
2902 
2910  virtual bool updateProviders(const NamedList& provider, bool save, bool update)
2911  { return false; }
2912 
2920  virtual bool callLogUpdate(const NamedList& params, bool save, bool update)
2921  { return false; }
2922 
2928  virtual bool callLogDelete(const String& billid)
2929  { return false; }
2930 
2939  virtual bool callLogClear(const String& table, const String& direction)
2940  { return false; }
2941 
2948  virtual bool callLogCall(const String& billid, Window* wnd = 0)
2949  { return false; }
2950 
2956  virtual bool callLogCreateContact(const String& billid)
2957  { return false; }
2958 
2965  virtual bool help(const String& action, Window* wnd)
2966  { return false; }
2967 
2972  virtual bool calltoLoaded()
2973  { return false; }
2974 
2978  virtual void loadedWindows()
2979  {}
2980 
2984  virtual void initializedWindows()
2985  {}
2986 
2993  virtual bool initializedClient()
2994  { return false; }
2995 
3000  virtual void exitingClient()
3001  {}
3002 
3009  virtual bool handleUiAction(Message& msg, bool& stopLogic)
3010  { return false; }
3011 
3018  virtual bool handleCallCdr(Message& msg, bool& stopLogic)
3019  { return false; }
3020 
3027  virtual bool handleUserLogin(Message& msg, bool& stopLogic)
3028  { return false; }
3029 
3036  virtual bool handleUserNotify(Message& msg, bool& stopLogic)
3037  { return false; }
3038 
3045  virtual bool handleUserRoster(Message& msg, bool& stopLogic)
3046  { return false; }
3047 
3054  virtual bool handleResourceNotify(Message& msg, bool& stopLogic)
3055  { return false; }
3056 
3063  virtual bool handleResourceSubscribe(Message& msg, bool& stopLogic)
3064  { return false; }
3065 
3072  virtual bool handleClientChanUpdate(Message& msg, bool& stopLogic)
3073  { return false; }
3074 
3081  virtual bool handleContactInfo(Message& msg, bool& stopLogic)
3082  { return false; }
3083 
3093  virtual bool defaultMsgHandler(Message& msg, int id, bool& stopLogic)
3094  { return false; }
3095 
3100  virtual void engineStart(Message& msg)
3101  {}
3102 
3109  virtual bool addDurationUpdate(DurationUpdate* duration, bool autoDelete = false);
3110 
3117  virtual bool removeDurationUpdate(const String& name, bool delObj = false);
3118 
3125  virtual bool removeDurationUpdate(DurationUpdate* duration, bool delObj = false);
3126 
3133  virtual DurationUpdate* findDurationUpdate(const String& name, bool ref = true);
3134 
3138  virtual void clearDurationUpdate();
3139 
3143  virtual void destruct();
3144 
3151  static const String& cdrRemoteParty(const NamedList& params, bool outgoing)
3152  { return outgoing ? params[YSTRING("called")] : params[YSTRING("caller")]; }
3153 
3159  static const String& cdrRemoteParty(const NamedList& params) {
3160  const String& dir = params[YSTRING("direction")];
3161  if (dir == YSTRING("incoming"))
3162  return cdrRemoteParty(params,true);
3163  if (dir == YSTRING("outgoing"))
3164  return cdrRemoteParty(params,false);
3165  return String::empty();
3166  }
3167 
3172  static void initStaticData();
3173 
3181  static bool saveContact(Configuration& cfg, ClientContact* c, bool save = true);
3182 
3190  static bool clearContact(Configuration& cfg, ClientContact* c, bool save = true);
3191 
3192  // Account options string list
3193  static ObjList s_accOptions;
3194  // Parameters that are applied from provider template
3195  static const char* s_provParams[];
3196  // The list of protocols supported by the client
3197  static ObjList s_protocols;
3198  // Mutext used to lock protocol list
3199  static Mutex s_protocolsMutex;
3200 
3201 protected:
3207  ClientLogic(const char* name, int priority);
3208 
3214  virtual void idleTimerTick(Time& time)
3215  {}
3216 
3217  ObjList m_durationUpdate; // Duration updates
3218  Mutex m_durationMutex; // Lock duration operations
3219 
3220 private:
3221  ClientLogic() {} // No default constructor
3222 
3223  String m_name; // Logic's name
3224  int m_prio; // Logics priority
3225 };
3226 
3227 class FtManager;
3228 
3233 class YATE_API DefaultLogic : public ClientLogic
3234 {
3236  YNOCOPY(DefaultLogic); // no automatic copies please
3237 public:
3243  explicit DefaultLogic(const char* name = "default", int prio = -100);
3244 
3248  ~DefaultLogic();
3249 
3257  virtual bool action(Window* wnd, const String& name, NamedList* params = 0);
3258 
3266  virtual bool toggle(Window* wnd, const String& name, bool active);
3267 
3276  virtual bool select(Window* wnd, const String& name, const String& item,
3277  const String& text = String::empty());
3278 
3286  virtual bool select(Window* wnd, const String& name, const NamedList& items);
3287 
3296  virtual bool setClientParam(const String& param, const String& value,
3297  bool save, bool update);
3298 
3303  virtual bool imIncoming(Message& msg);
3304 
3312  virtual bool callIncoming(Message& msg, const String& dest);
3313 
3320  virtual bool validateCall(NamedList& params, Window* wnd = 0);
3321 
3330  virtual bool callStart(NamedList& params, Window* wnd = 0,
3331  const String& cmd = String::empty());
3332 
3340  virtual bool digitPressed(NamedList& params, Window* wnd = 0);
3341 
3349  virtual bool editAccount(bool newAcc, NamedList* params, Window* wnd = 0);
3350 
3357  virtual bool acceptAccount(NamedList* params, Window* wnd = 0);
3358 
3365  virtual bool delAccount(const String& account, Window* wnd = 0);
3366 
3374  virtual bool updateAccount(const NamedList& account, bool login, bool save);
3375 
3382  virtual bool loginAccount(const NamedList& account, bool login);
3383 
3392  virtual bool updateContact(const NamedList& contact, bool save, bool update);
3393 
3400  virtual bool acceptContact(NamedList* params, Window* wnd = 0);
3401 
3409  virtual bool editContact(bool newCont, NamedList* params = 0, Window* wnd = 0);
3410 
3417  virtual bool delContact(const String& contact, Window* wnd = 0);
3418 
3425  virtual bool callContact(NamedList* params = 0, Window* wnd = 0);
3426 
3434  virtual bool updateProviders(const NamedList& provider, bool save, bool update);
3435 
3443  virtual bool callLogUpdate(const NamedList& params, bool save, bool update);
3444 
3450  virtual bool callLogDelete(const String& billid);
3451 
3460  virtual bool callLogClear(const String& table, const String& direction);
3461 
3468  virtual bool callLogCall(const String& billid, Window* wnd = 0);
3469 
3475  virtual bool callLogCreateContact(const String& billid);
3476 
3483  virtual bool help(const String& action, Window* wnd);
3484 
3489  virtual bool calltoLoaded();
3490 
3494  virtual void loadedWindows()
3495  {}
3496 
3500  virtual void initializedWindows();
3501 
3508  virtual bool initializedClient();
3509 
3514  virtual void exitingClient();
3515 
3522  virtual bool handleUiAction(Message& msg, bool& stopLogic);
3523 
3530  virtual bool handleCallCdr(Message& msg, bool& stopLogic);
3531 
3538  virtual bool handleUserLogin(Message& msg, bool& stopLogic);
3539 
3546  virtual bool handleUserNotify(Message& msg, bool& stopLogic);
3547 
3554  virtual bool handleUserRoster(Message& msg, bool& stopLogic);
3555 
3562  virtual bool handleResourceNotify(Message& msg, bool& stopLogic);
3563 
3570  virtual bool handleResourceSubscribe(Message& msg, bool& stopLogic);
3571 
3578  virtual bool handleClientChanUpdate(Message& msg, bool& stopLogic);
3579 
3586  virtual bool handleContactInfo(Message& msg, bool& stopLogic);
3587 
3597  virtual bool defaultMsgHandler(Message& msg, int id, bool& stopLogic);
3598 
3604  virtual void updateSelectedChannel(const String* item = 0);
3605 
3610  virtual void engineStart(Message& msg);
3611 
3616  virtual void showInCallNotification(ClientChannel* chan);
3617 
3622  virtual void closeInCallNotification(const String& id);
3623 
3632  static inline String& buildAccountId(String& accId, const String& proto,
3633  const String& user, const String& host) {
3634  accId = proto + ":" + user + "@" + host;
3635  return accId;
3636  }
3637 
3638 protected:
3644  virtual void idleTimerTick(Time& time);
3645 
3651  virtual bool enableCallActions(const String& id);
3652 
3659  virtual bool fillCallStart(NamedList& p, Window* wnd = 0);
3660 
3666  virtual void channelSelectionChanged(const String& old);
3667 
3675  virtual void fillContactEditActive(NamedList& list, bool active, const String* item = 0,
3676  bool del = true);
3677 
3684  virtual void fillLogContactActive(NamedList& list, bool active, const String* item = 0);
3685 
3693  virtual bool clearList(const String& action, Window* wnd);
3694 
3703  virtual bool deleteItem(const String& list, const String& item, Window* wnd,
3704  bool confirm);
3705 
3714  virtual bool deleteCheckedItems(const String& list, Window* wnd, bool confirm);
3715 
3725  virtual bool deleteSelectedItem(const String& action, Window* wnd, bool checked = false);
3726 
3733  virtual bool handleTextChanged(NamedList* params, Window* wnd);
3734 
3742  virtual bool handleFileTransferAction(const String& name, Window* wnd, NamedList* params = 0);
3743 
3751  virtual bool handleFileTransferNotify(Message& msg, bool& stopLogic);
3752 
3759  virtual bool handleUserData(Message& msg, bool& stopLogic);
3760 
3767  virtual bool handleFileInfo(Message& msg, bool& stopLogic);
3768 
3776  virtual void notifyGenericError(const String& text,
3777  const String& account = String::empty(),
3778  const String& contact = String::empty(),
3779  const char* title = "Error");
3780 
3788  virtual void notifyNoAudio(bool show, bool micOk = false, bool speakerOk = false,
3789  ClientChannel* chan = 0);
3790 
3797  virtual void updateChatRoomsContactList(bool load, ClientAccount* acc,
3798  MucRoom* room = 0);
3799 
3805  virtual void joinRoom(MucRoom* room, bool force = false);
3806 
3807  String m_selectedChannel; // The currently selected channel
3808  String m_transferInitiated; // Tranfer initiated id
3809 
3810 private:
3811  // Add/set an account changed in UI
3812  // replace: Optional editing account to replace
3813  bool updateAccount(const NamedList& account, bool save,
3814  const String& replace = String::empty(), bool loaded = false);
3815  // Add/edit an account
3816  bool internalEditAccount(bool newAcc, const String* account, NamedList* params, Window* wnd);
3817  // Handle dialog actions. Return true if handled
3818  bool handleDialogAction(const String& name, bool& retVal, Window* wnd);
3819  // Handle chat and contact related actions. Return true if handled
3820  bool handleChatContactAction(const String& name, Window* wnd);
3821  // Handle chat contact edit ok button press. Return true if handled
3822  bool handleChatContactEditOk(const String& name, Window* wnd);
3823  // Handle chat room contact edit ok button press. Return true if handled
3824  bool handleChatRoomEditOk(const String& name, Window* wnd);
3825  // Handle actions from MUCS window. Return true if handled
3826  bool handleMucsAction(const String& name, Window* wnd, NamedList* params);
3827  // Handle ok button in muc invite window. Return true if handled
3828  bool handleMucInviteOk(Window* wnd);
3829  // Handle select from MUCS window. Return true if handled
3830  bool handleMucsSelect(const String& name, const String& item, Window* wnd,
3831  const String& text = String::empty());
3832  // Handle resource.notify messages from MUC rooms
3833  // The account was already checked
3834  bool handleMucResNotify(Message& msg, ClientAccount* acc, const String& contact,
3835  const String& instance, const String& operation);
3836  // Show/hide the notification area (messages).
3837  // Update rows if requested. Add/remove tray notification/info icon
3838  bool showNotificationArea(bool show, Window* wnd, NamedList* upd = 0,
3839  const char* notif = "notification");
3840  // Show a roster change or failure notification
3841  void showUserRosterNotification(ClientAccount* a, const String& oper,
3842  Message& msg, const String& contactUri = String::empty(),
3843  bool newContact = true);
3844  // Handle actions from notification area. Return true if handled
3845  bool handleNotificationAreaAction(const String& action, Window* wnd);
3846  // Save a contact to config. Save chat rooms if the contact is a chat room
3847  bool storeContact(ClientContact* c);
3848  // Handle ok from account password/credentials input window
3849  bool handleAccCredInput(Window* wnd, const String& name, bool inputPwd);
3850  // Handle channel show/hide transfer/conference toggles
3851  bool handleChanShowExtra(Window* wnd, bool show, const String& chan, bool conf);
3852  // Handle conf/transfer start actions in channel item
3853  bool handleChanItemConfTransfer(bool conf, const String& name, Window* wnd);
3854  // Handle file share(d) related action
3855  bool handleFileShareAction(Window* wnd, const String& name, NamedList* params);
3856  // Handle file share(d) related select
3857  bool handleFileShareSelect(Window* wnd, const String& name, const String& item,
3858  const String& text, const NamedList* items);
3859  // Handle file share(d) item changes from UI
3860  bool handleFileShareItemChanged(Window* wnd, const String& name, const String& item,
3861  const NamedList& params);
3862  // Handle file share(d) drop events
3863  bool handleFileShareDrop(bool askOnly, Window* wnd, const String& name,
3864  NamedList& params, bool& retVal);
3865  // Handle list item change action
3866  bool handleListItemChanged(Window* wnd, const String& list, const String& item,
3867  const NamedList& params);
3868  // Handle drop events
3869  bool handleDrop(bool askOnly, Window* wnd, const String& name,
3870  NamedList& params);
3871  // Handle file share info changed notification
3872  void handleFileSharedChanged(ClientAccount* a, const String& contact,
3873  const String& inst);
3874 
3875  ClientAccountList* m_accounts; // Accounts list (always valid)
3876  FtManager* m_ftManager; // Private file manager
3877 };
3878 
3879 
3884 class YATE_API ClientAccount : public RefObject, public Mutex
3885 {
3886  friend class ClientContact;
3887  friend class MucRoom;
3889  YNOCOPY(ClientAccount); // no automatic copies please
3890 public:
3899  explicit ClientAccount(const char* proto, const char* user, const char* host,
3900  bool startup, ClientContact* contact = 0);
3901 
3908  explicit ClientAccount(const NamedList& params, ClientContact* contact = 0);
3909 
3914  inline const NamedList& params() const
3915  { return m_params; }
3916 
3921  inline ObjList& contacts()
3922  { return m_contacts; }
3923 
3928  inline ObjList& mucs()
3929  { return m_mucs; }
3930 
3935  inline ClientContact* contact() const
3936  { return m_contact; }
3937 
3942  void setContact(ClientContact* contact);
3943 
3948  inline const String& protocol() const
3949  { return m_params[YSTRING("protocol")]; }
3950 
3955  inline bool hasChat() const
3956  { return protocol() == YSTRING("jabber"); }
3957 
3962  inline bool hasPresence() const
3963  { return protocol() == YSTRING("jabber"); }
3964 
3969  inline bool startup() const
3970  { return m_params.getBoolValue(YSTRING("enabled"),true); }
3971 
3976  inline void startup(bool ok)
3977  { m_params.setParam("enabled",String::boolText(ok)); }
3978 
3983  virtual const String& toString() const
3984  { return m_params; }
3985 
3990  ClientResource* resource(bool ref);
3991 
3996  inline ClientResource& resource() const
3997  { return *m_resource; }
3998 
4003  void setResource(ClientResource* res);
4004 
4012  bool save(bool ok = true, bool savePwd = true);
4013 
4020  virtual ClientContact* findContact(const String& id, bool ref = false);
4021 
4030  virtual ClientContact* findContact(const String* name = 0, const String* uri = 0,
4031  const String* skipId = 0, bool ref = false);
4032 
4040  virtual ClientContact* findContact(const String& id, const String& resid,
4041  bool ref = false);
4042 
4049  virtual ClientContact* findContactByUri(const String& uri, bool ref = false);
4050 
4057  virtual MucRoom* findRoom(const String& id, bool ref = false);
4058 
4065  virtual MucRoom* findRoomByUri(const String& uri, bool ref = false);
4066 
4073  virtual ClientContact* findAnyContact(const String& id, bool ref = false);
4074 
4082  virtual ClientContact* appendContact(const String& id, const char* name,
4083  const char* uri = 0);
4084 
4090  virtual ClientContact* appendContact(const NamedList& params);
4091 
4098  virtual ClientContact* removeContact(const String& id, bool delObj = true);
4099 
4105  virtual void clearRooms(bool saved, bool temp);
4106 
4113  virtual Message* userlogin(bool login, const char* msg = "user.login");
4114 
4123  virtual Message* userData(bool update, const String& data,
4124  const char* msg = "user.data");
4125 
4130  virtual void fillItemParams(NamedList& list);
4131 
4136  inline const String& dataDir() const
4137  { return m_params[YSTRING("datadirectory")]; }
4138 
4146  virtual bool setupDataDir(String* errStr = 0, bool saveAcc = true);
4147 
4155  virtual bool loadDataDirCfg(Configuration* cfg = 0,
4156  const char* file = "account.conf");
4157 
4163  virtual void loadContacts(Configuration* cfg = 0);
4164 
4170  virtual bool clearDataDir(String* errStr = 0);
4171 
4172  NamedList m_params; // Account parameters
4173  Configuration m_cfg; // Account conf file
4174 
4175 protected:
4176  // Remove from owner. Release data
4177  virtual void destroyed();
4178  // Method used by the contact to append itself to this account's list
4179  virtual void appendContact(ClientContact* contact, bool muc = false);
4180 
4181  ObjList m_contacts; // Account's contacts
4182  ObjList m_mucs; // Account's MUC contacts
4183 
4184 private:
4185  ClientResource* m_resource; // Account's resource
4186  ClientContact* m_contact; // Account's contact data
4187 };
4188 
4193 class YATE_API ClientAccountList : public String, public Mutex
4194 {
4196  YNOCOPY(ClientAccountList); // no automatic copies please
4197 public:
4203  inline explicit ClientAccountList(const char* name, ClientAccount* localContacts = 0)
4204  : String(name), Mutex(true,"ClientAccountList"),
4205  m_localContacts(localContacts)
4206  { }
4207 
4211  ~ClientAccountList();
4212 
4217  inline ObjList& accounts()
4218  { return m_accounts; }
4219 
4225  { return m_localContacts; }
4226 
4232  bool isLocalContact(ClientContact* c) const;
4233 
4239  inline bool isLocalContact(const String& id) const
4240  { return m_localContacts && m_localContacts->findContact(id); }
4241 
4248  virtual ClientAccount* findAccount(const String& id, bool ref = false);
4249 
4257  virtual ClientContact* findContactByUri(const String& account, const String& uri,
4258  bool ref = false);
4259 
4267  virtual ClientContact* findContact(const String& account, const String& id, bool ref = false);
4268 
4275  virtual ClientContact* findContact(const String& builtId, bool ref = false);
4276 
4284  virtual ClientContact* findContactByInstance(const String& id, String* instance = 0,
4285  bool ref = false);
4286 
4293  virtual MucRoom* findRoom(const String& id, bool ref = false);
4294 
4301  virtual MucRoom* findRoomByMember(const String& id, bool ref = false);
4302 
4309  virtual ClientContact* findAnyContact(const String& id, bool ref = false);
4310 
4317  virtual ClientAccount* findSingleRegAccount(const String* skipProto = 0,
4318  bool ref = false);
4319 
4325  virtual bool appendAccount(ClientAccount* account);
4326 
4331  virtual void removeAccount(const String& id);
4332 
4333 protected:
4334  ObjList m_accounts;
4335 
4336 private:
4337  ClientAccountList() {} // Avoid using the default constructor
4338  ClientAccount* m_localContacts; // Account owning locally stored contacts
4339 };
4340 
4346 class YATE_API ClientContact : public RefObject
4347 {
4348  friend class ClientAccount;
4350  YNOCOPY(ClientContact); // no automatic copies please
4351 public:
4356  SubFrom = 0x01,
4357  SubTo = 0x02,
4358  };
4359 
4367  explicit ClientContact(ClientAccount* owner, const char* id, const char* name = 0,
4368  const char* uri = 0);
4369 
4378  explicit ClientContact(ClientAccount* owner, const NamedList& params, const char* id = 0,
4379  const char* uri = 0);
4380 
4386  { return m_owner; }
4387 
4392  inline const String& accountName() const
4393  { return m_owner ? m_owner->toString() : String::empty(); }
4394 
4399  inline const URI& uri() const
4400  { return m_uri; }
4401 
4406  inline void setUri(const char* u)
4407  { m_uri = u; }
4408 
4413  inline const String& subscriptionStr() const
4414  { return m_subscription; }
4415 
4420  inline bool subscriptionFrom() const
4421  { return 0 != m_sub.flag(SubFrom); }
4422 
4427  inline bool subscriptionTo() const
4428  { return 0 != m_sub.flag(SubTo); }
4429 
4435  bool setSubscription(const String& value);
4436 
4441  inline ObjList& resources()
4442  { return m_resources; }
4443 
4448  inline bool online() const
4449  { return m_online || 0 != m_resources.skipNull(); }
4450 
4455  inline void setOnline(bool on)
4456  { m_online = on; }
4457 
4462  inline ObjList& groups()
4463  { return m_groups; }
4464 
4470  inline bool local(bool defVal = false) const
4471  { return m_params.getBoolValue(YSTRING("local"),defVal); }
4472 
4477  inline void setLocal(bool on)
4478  { m_params.setParam("local",String::boolText(on)); }
4479 
4485  inline bool remote(bool defVal = false) const
4486  { return m_params.getBoolValue(YSTRING("remote"),defVal); }
4487 
4492  inline void setRemote(bool on)
4493  { m_params.setParam("remote",String::boolText(on)); }
4494 
4499  inline void setDockedChat(bool on) {
4500  if (!mucRoom())
4501  m_dockedChat = on;
4502  }
4503 
4508  inline void getContactSection(String& buf) {
4509  String pref;
4510  buf = toString();
4511  buf.startSkip(buildContactId(pref,accountName(),String::empty()),false);
4512  buf = buf.uriUnescape();
4513  }
4514 
4519  virtual const String& toString() const
4520  { return m_id; }
4521 
4526  virtual MucRoom* mucRoom()
4527  { return 0; }
4528 
4535  inline String& buildInstanceId(String& dest, const String& inst = String::empty())
4536  { return buildContactInstanceId(dest,m_id,inst); }
4537 
4543  inline void buildIdHash(String& buf, const String& prefix = String::empty()) {
4544  MD5 md5(m_id);
4545  buf = prefix + md5.hexDigest();
4546  }
4547 
4553  inline bool isChatWnd(Window* wnd)
4554  { return wnd && wnd->toString() == m_chatWndName; }
4555 
4560  bool hasChat();
4561 
4566  virtual void flashChat(bool on = true);
4567 
4576  virtual bool sendChat(const char* body, const String& res = String::empty(),
4577  const String& type = String::empty(), const char* state = "active");
4578 
4584  virtual void getChatInput(String& text, const String& name = "message");
4585 
4591  virtual void setChatInput(const String& text = String::empty(),
4592  const String& name = "message");
4593 
4600  virtual void getChatHistory(String& text, bool richText = false,
4601  const String& name = "history");
4602 
4609  virtual void setChatHistory(const String& text, bool richText = false,
4610  const String& name = "history");
4611 
4618  virtual void addChatHistory(const String& what, NamedList*& params,
4619  const String& name = "history");
4620 
4627  virtual void getChatProperty(const String& name, const String& prop, String& value);
4628 
4635  virtual void setChatProperty(const String& name, const String& prop, const String& value);
4636 
4641  inline bool isChatVisible()
4642  { return Client::self() && Client::self()->getVisible(m_chatWndName); }
4643 
4650  virtual bool showChat(bool visible, bool active = false);
4651 
4656  Window* getChatWnd();
4657 
4663  virtual void createChatWindow(bool force = false, const char* name = 0);
4664 
4671  virtual void updateChatWindow(const NamedList& params, const char* title = 0,
4672  const char* icon = 0);
4673 
4678  virtual bool isChatActive();
4679 
4683  void destroyChatWindow();
4684 
4690  virtual String* findGroup(const String& group);
4691 
4697  virtual bool appendGroup(const String& group);
4698 
4704  virtual bool removeGroup(const String& group);
4705 
4712  virtual bool setGroups(const NamedList& list, const String& param);
4713 
4719  virtual ClientResource* status(bool ref = false);
4720 
4727  virtual ClientResource* findResource(const String& id, bool ref = false);
4728 
4734  virtual ClientResource* findAudioResource(bool ref = false);
4735 
4741  virtual ClientResource* findFileTransferResource(bool ref = false);
4742 
4748  virtual ClientResource* appendResource(const String& id);
4749 
4756  virtual bool insertResource(ClientResource* res);
4757 
4763  virtual bool removeResource(const String& id);
4764 
4769  inline NamedList& share()
4770  { return m_share; }
4771 
4776  inline bool haveShare() const
4777  { return 0 != m_share.getParam(0); }
4778 
4782  virtual void updateShare();
4783 
4787  virtual void saveShare();
4788 
4792  virtual void clearShare();
4793 
4802  virtual bool setShareDir(const String& name, const String& path, bool save = true);
4803 
4810  virtual bool removeShare(const String& name, bool save = true);
4811 
4816  inline ObjList& shared()
4817  { return m_shared; }
4818 
4823  bool haveShared() const;
4824 
4831  virtual ClientDir* getShared(const String& name, bool create = false);
4832 
4839  virtual bool removeShared(const String& name = String::empty(), ClientDir** removed = 0);
4840 
4848  static inline String& buildContactId(String& dest, const String& account,
4849  const String& contact) {
4850  dest << account.uriEscape('|') << "|" << String::uriEscape(contact,'|').toLower();
4851  return dest;
4852  }
4853 
4859  static inline void splitContactId(const String& src, String& account) {
4860  int pos = src.find('|');
4861  if (pos >= 0)
4862  account = src.substr(0,pos).uriUnescape();
4863  else
4864  account = src.uriUnescape();
4865  }
4866 
4874  static void splitContactInstanceId(const String& src, String& account,
4875  String& contact, String* instance = 0);
4876 
4884  static inline String& buildContactInstanceId(String& dest, const String& cId,
4885  const String& inst = String::empty()) {
4886  dest << cId << "|" << inst.uriEscape('|');
4887  return dest;
4888  }
4889 
4890  // Chat window prefix
4891  static String s_chatPrefix;
4892  // Docked chat window name
4893  static String s_dockedChatWnd;
4894  // Docked chat widget name
4895  static String s_dockedChatWidget;
4896  // MUC rooms window name
4897  static String s_mucsWnd;
4898  // Chat input widget name
4899  static String s_chatInput;
4900 
4901  String m_name; // Contact's display name
4902  NamedList m_params; // Optional contact extra params
4903 
4904 protected:
4911  explicit ClientContact(ClientAccount* owner, const char* id, bool mucRoom);
4912 
4916  void removeFromOwner();
4917 
4921  virtual void destroyed();
4922 
4923  ClientAccount* m_owner; // The account owning this contact
4924  bool m_online; // Online flag
4925  String m_id; // The contact's id
4926  String m_subscription; // Presence subscription state
4927  Flags32 m_sub; // Subscription flags
4928  URI m_uri; // The contact's URI
4929  ObjList m_resources; // The contact's resource list
4930  ObjList m_groups; // The group(s) this contact belongs to
4931  bool m_dockedChat; // Docked chat flag
4932  String m_chatWndName; // Chat window name if any
4933  NamedList m_share; // List of files and folders we share
4934  ObjList m_shared; // List of shared. Each entry is a ClientDir whose name is the resource
4935 };
4936 
4941 class YATE_API ClientResource : public RefObject
4942 {
4944  YNOCOPY(ClientResource); // no automatic copies please
4945 public:
4949  enum Status {
4950  Unknown = 0,
4951  Offline = 1,
4952  Connecting = 2,
4953  Online = 3,
4954  Busy = 4,
4955  Dnd = 5,
4956  Away = 6,
4957  Xa = 7,
4958  };
4959 
4963  enum Capability {
4964  CapAudio = 0x00000001, // Audio
4965  CapFileTransfer = 0x00000002, // File transfer support
4966  CapFileInfo = 0x00000004, // File info share support
4967  CapRsm = 0x00000008, // Result set management support
4968  };
4969 
4976  inline explicit ClientResource(const char* id, const char* name = 0, bool audio = true)
4977  : m_id(id), m_name(name ? name : id), m_caps(audio ? CapAudio : 0),
4978  m_priority(0), m_status(Offline)
4979  { }
4980 
4985  virtual const String& toString() const
4986  { return m_id; }
4987 
4992  inline bool online() const
4993  { return m_status > Connecting; }
4994 
4999  inline bool offline() const
5000  { return m_status == Offline; }
5001 
5006  inline const char* statusName() const
5007  { return lookup(m_status,s_statusName); }
5008 
5013  inline const char* text() const
5014  { return m_text ? m_text.c_str() : statusDisplayText(m_status); }
5015 
5020  inline Flags32& caps()
5021  { return m_caps; }
5022 
5028  inline bool setAudio(bool ok)
5029  { return m_caps.changeFlagCheck(CapAudio,ok); }
5030 
5036  inline bool setFileTransfer(bool ok)
5037  { return m_caps.changeFlagCheck(CapFileTransfer,ok); }
5038 
5044  inline bool setPriority(int prio) {
5045  if (m_priority == prio)
5046  return false;
5047  m_priority = prio;
5048  return true;
5049  }
5050 
5056  inline bool setStatus(int stat) {
5057  if (m_status == stat)
5058  return false;
5059  m_status = stat;
5060  return true;
5061  }
5062 
5068  inline bool setStatusText(const String& text = String::empty()) {
5069  if (m_text == text)
5070  return false;
5071  m_text = text;
5072  return true;
5073  }
5074 
5081  static inline const char* statusDisplayText(int status, const char* defVal = 0)
5082  { return lookup(status,s_statusName,defVal); }
5083 
5087  static const TokenDict s_statusName[];
5088 
5092  static const TokenDict s_resNotifyCaps[];
5093 
5094  String m_id; // The resource id
5095  String m_name; // Resource display name
5096  Flags32 m_caps; // Resource capabilities
5097  int m_priority; // Resource priority
5098  int m_status; // Resource status
5099  String m_text; // Resource status text
5100 };
5101 
5107 class YATE_API MucRoomMember : public ClientResource
5108 {
5110  YNOCOPY(MucRoomMember); // no automatic copies please
5111 public:
5116  AffUnknown = 0,
5117  AffNone,
5118  Outcast,
5119  Member,
5120  Admin,
5121  Owner
5122  };
5123 
5127  enum Role {
5128  RoleUnknown = 0,
5129  RoleNone, // No role (out of room)
5130  Visitor, // Can view room chat
5131  Participant, // Can only send chat
5132  Moderator // Room moderator: can kick members
5133  };
5134 
5141  inline explicit MucRoomMember(const char* id, const char* nick, const char* uri = 0)
5142  : ClientResource(id,nick),
5143  m_uri(uri), m_affiliation(AffNone), m_role(RoleNone)
5144  {}
5145 
5149  static const TokenDict s_affName[];
5150 
5154  static const TokenDict s_roleName[];
5155 
5156  String m_uri; // Member uri, if known
5157  String m_instance; // Member instance, if known
5158  int m_affiliation; // Member affiliation to the room
5159  int m_role; // Member role when present in room ('none' means not present)
5160 };
5161 
5171 class YATE_API MucRoom : public ClientContact
5172 {
5174  YNOCOPY(MucRoom); // no automatic copies please
5175 public:
5184  explicit MucRoom(ClientAccount* owner, const char* id, const char* name, const char* uri,
5185  const char* nick = 0);
5186 
5192  { return *m_resource; }
5193 
5199  inline bool ownMember(MucRoomMember* item) const
5200  { return m_resource == item; }
5201 
5207  inline bool ownMember(const String& item) const
5208  { return m_resource->toString() == item; }
5209 
5214  inline bool available() const {
5215  return m_resource->online() &&
5216  m_resource->m_role > MucRoomMember::RoleNone;
5217  }
5218 
5223  inline bool canChat() const
5224  { return available() && m_resource->m_role >= MucRoomMember::Visitor; }
5225 
5230  inline bool canChatPrivate() const
5231  { return available(); }
5232 
5237  inline bool canChangeSubject() const
5238  { return available() && m_resource->m_role == MucRoomMember::Moderator; }
5239 
5244  inline bool canInvite() const
5245  { return available(); }
5246 
5252  bool canKick(MucRoomMember* member) const;
5253 
5259  bool canBan(MucRoomMember* member) const;
5260 
5266  inline Message* buildMucRoom(const char* oper) {
5267  Message* m = Client::buildMessage("muc.room",accountName(),oper);
5268  m->addParam("room",uri());
5269  return m;
5270  }
5271 
5279  Message* buildJoin(bool join, bool history = true, unsigned int sNewer = 0);
5280 
5285  virtual MucRoom* mucRoom()
5286  { return this; }
5287 
5293  virtual ClientResource* status(bool ref = false)
5294  { return (!ref || m_resource->ref()) ? m_resource : 0; }
5295 
5301  MucRoomMember* findMember(const String& nick);
5302 
5309  MucRoomMember* findMember(const String& contact, const String& instance);
5310 
5316  MucRoomMember* findMemberById(const String& id);
5317 
5323  bool hasChat(const String& id);
5324 
5330  virtual void flashChat(const String& id, bool on = true);
5331 
5338  virtual void getChatInput(const String& id, String& text, const String& name = "message");
5339 
5346  virtual void setChatInput(const String& id, const String& text = String::empty(),
5347  const String& name = "message");
5348 
5356  virtual void getChatHistory(const String& id, String& text, bool richText = false,
5357  const String& name = "history");
5358 
5366  virtual void setChatHistory(const String& id, const String& text, bool richText = false,
5367  const String& name = "history");
5368 
5376  virtual void addChatHistory(const String& id, const String& what, NamedList*& params,
5377  const String& name = "history");
5378 
5386  virtual void setChatProperty(const String& id, const String& name, const String& prop,
5387  const String& value);
5388 
5396  virtual bool showChat(const String& id, bool visible, bool active = false);
5397 
5404  virtual void createChatWindow(const String& id, bool force = false, const char* name = 0);
5405 
5411  virtual void updateChatWindow(const String& id, const NamedList& params);
5412 
5417  virtual bool isChatActive(const String& id);
5418 
5423  void destroyChatWindow(const String& id = String::empty());
5424 
5431  virtual ClientResource* findResource(const String& id, bool ref = false);
5432 
5438  virtual ClientResource* appendResource(const String& nick);
5439 
5446  virtual bool insertResource(ClientResource* res)
5447  { return false; }
5448 
5455  virtual bool removeResource(const String& nick, bool delChat = false);
5456 
5461 
5462 protected:
5463  // Release data. Destroy all chats
5464  virtual void destroyed();
5465 
5466 private:
5467  unsigned int m_index; // Index used to build member id
5468  MucRoomMember* m_resource; // Account room identity and status
5469 };
5470 
5476 class YATE_API DurationUpdate : public RefObject
5477 {
5479  YNOCOPY(DurationUpdate); // no automatic copies please
5480 public:
5489  inline DurationUpdate(ClientLogic* logic, bool owner, const char* id,
5490  const char* name, unsigned int start = Time::secNow())
5491  : m_id(id), m_logic(0), m_name(name), m_startTime(start)
5492  { setLogic(logic,owner); }
5493 
5497  virtual ~DurationUpdate();
5498 
5503  virtual const String& toString() const;
5504 
5510  void setLogic(ClientLogic* logic = 0, bool owner = true);
5511 
5521  virtual unsigned int update(unsigned int secNow, const String* table = 0,
5522  Window* wnd = 0, Window* skip = 0, bool force = false);
5523 
5531  virtual unsigned int buildTimeParam(NamedList& dest, unsigned int secNow,
5532  bool force = false);
5533 
5541  virtual unsigned int buildTimeString(String& dest, unsigned int secNow,
5542  bool force = false);
5543 
5553  static unsigned int buildTimeParam(NamedList& dest, const char* param, unsigned int secStart,
5554  unsigned int secNow, bool force = false);
5555 
5564  static unsigned int buildTimeString(String& dest, unsigned int secStart, unsigned int secNow,
5565  bool force = false);
5566 
5567 protected:
5571  virtual void destroyed();
5572 
5573  String m_id; // Duration's id
5574  ClientLogic* m_logic; // Client logic having this object in its list
5575  String m_name; // Widget/column name
5576  unsigned int m_startTime; // Start time
5577 };
5578 
5583 class YATE_API ClientSound : public String
5584 {
5586  YNOCOPY(ClientSound); // no automatic copies please
5587 public:
5594  inline ClientSound(const char* name, const char* file, const char* device = 0)
5595  : String(name), m_native(false), m_file(file), m_device(device), m_repeat(0),
5596  m_started(false), m_stereo(false)
5597  { }
5598 
5602  virtual ~ClientSound()
5603  { stop(); }
5604 
5608  virtual void destruct() {
5609  stop();
5610  String::destruct();
5611  }
5612 
5618  inline bool native() const
5619  { return m_native; }
5620 
5625  inline bool started() const
5626  { return m_started; }
5627 
5632  inline const String& device() const
5633  { return m_device; }
5634 
5639  inline void device(const char* dev)
5640  { Lock lock(s_soundsMutex); m_device = dev; }
5641 
5646  inline const String& file() const
5647  { return m_file; }
5648 
5655  inline void file(const char* filename, bool stereo)
5656  { Lock lock(s_soundsMutex); m_file = filename; m_stereo = stereo; }
5657 
5663  inline void setRepeat(unsigned int count)
5664  { m_repeat = count; }
5665 
5670  inline bool stereo() const
5671  { return m_stereo; }
5672 
5678  bool start(bool force = true);
5679 
5683  void stop();
5684 
5690  void setChannel(const String& chan, bool ok);
5691 
5697  bool attachSource(ClientChannel* chan);
5698 
5710  static bool build(const String& id, const char* file, const char* device = 0,
5711  unsigned int repeat = 0, bool resetExisting = true, bool stereo = false);
5712 
5718  static bool started(const String& name);
5719 
5726  static bool start(const String& name, bool force = true);
5727 
5732  static void stop(const String& name);
5733 
5740  static ClientSound* find(const String& token, bool byName = true);
5741 
5746 
5751 
5757 
5758 protected:
5759  virtual bool doStart();
5760  virtual void doStop();
5761 
5762  bool m_native; // Native (system dependent) sound
5763  String m_file;
5764  String m_device;
5765  unsigned int m_repeat;
5766  bool m_started;
5767  bool m_stereo;
5768  String m_channel; // Utility channel using this sound
5769 };
5770 
5775 class YATE_API ClientFileItem : public GenObject
5776 {
5778  YNOCOPY(ClientFileItem); // no automatic copies please
5779 public:
5784  inline ClientFileItem(const char* name)
5785  : m_name(name)
5786  {}
5787 
5792  inline const String& name() const
5793  { return m_name; }
5794 
5800  { return 0; }
5801 
5806  virtual ClientFile* file()
5807  { return 0; }
5808 
5813  virtual const String& toString() const
5814  { return name(); }
5815 
5816 private:
5817  ClientFileItem() {} // No default constructor
5818  String m_name;
5819 };
5820 
5825 class YATE_API ClientDir: public ClientFileItem
5826 {
5828 public:
5833  inline ClientDir(const char* name)
5834  : ClientFileItem(name), m_updated(false)
5835  {}
5836 
5841  inline ClientDir(const ClientDir& other)
5842  : ClientFileItem(other.name()), m_updated(other.updated())
5843  { copyChildren(other.m_children); }
5844 
5849  inline ObjList& children()
5850  { return m_children; }
5851 
5856  inline bool updated() const
5857  { return m_updated; }
5858 
5863  inline void updated(bool on)
5864  { m_updated = on; }
5865 
5870  bool treeUpdated() const;
5871 
5878  ClientDir* addDir(const String& name);
5879 
5886  ClientDir* addDirPath(const String& path, const char* sep = "/");
5887 
5892  void copyChildren(const ObjList& list);
5893 
5898  void addChildren(ObjList& list);
5899 
5905  bool addChild(ClientFileItem* item);
5906 
5913  ClientFileItem* findChild(const String& path, const char* sep = "/");
5914 
5920  inline ClientFileItem* findChildName(const String& name) {
5921  ObjList* o = m_children.find(name);
5922  return o ? static_cast<ClientFileItem*>(o->get()) : 0;
5923  }
5924 
5930  { return this; }
5931 
5932 protected:
5933  ObjList m_children;
5934  bool m_updated;
5935 };
5936 
5941 class YATE_API ClientFile: public ClientFileItem
5942 {
5944 public:
5950  inline ClientFile(const char* name, const NamedList* params = 0)
5951  : ClientFileItem(name), m_params("") {
5952  if (params)
5953  m_params.copyParams(*params);
5954  }
5955 
5960  inline ClientFile(const ClientFile& other)
5961  : ClientFileItem(other.name()), m_params(other.params())
5962  {}
5963 
5968  inline NamedList& params()
5969  { return m_params; }
5970 
5975  inline const NamedList& params() const
5976  { return m_params; }
5977 
5982  virtual ClientFile* file()
5983  { return this; }
5984 
5985 protected:
5986  NamedList m_params;
5987 };
5988 
5989 }; // namespace TelEngine
5990 
5991 #endif /* __YATECBASE_H */
5992 
5993 /* vi: set ts=8 sw=4 sts=4 noet: */
virtual const String & toString() const
Definition: yatecbase.h:4985
Definition: yatecbase.h:754
bool oneThread() const
Definition: yatecbase.h:1295
virtual bool loginAccount(const NamedList &account, bool login)
Definition: yatecbase.h:2852
void setRemote(bool on)
Definition: yatecbase.h:4492
virtual bool handleClientChanUpdate(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3072
u_int32_t flags() const
Definition: yatecbase.h:86
A static user interface creator.
Definition: yatecbase.h:938
static String uriEscape(const char *str, char extraEsc=0, const char *noEsc=0)
NamedInt(const char *name, int val=0)
Definition: yatecbase.h:172
virtual bool setSelect(const String &item)
Definition: yatecbase.h:877
virtual bool setClientParam(const String &param, const String &value, bool save, bool update)
Definition: yatecbase.h:2721
virtual bool delTableRow(const String &item)
Definition: yatecbase.h:844
void addSlave(const String &sid)
Definition: yatecbase.h:2217
Affiliation
Definition: yatecbase.h:5115
bool hasPresence() const
Definition: yatecbase.h:3962
static String & buildContactInstanceId(String &dest, const String &cId, const String &inst=String::empty())
Definition: yatecbase.h:4884
const String & transferId() const
Definition: yatecbase.h:2271
ClientFile(const char *name, const NamedList *params=0)
Definition: yatecbase.h:5950
const URI & uri() const
Definition: yatecbase.h:4399
static const String & lookupName(const ObjList &list, int val, const String &defVal=String::empty())
Definition: yatecbase.h:231
virtual const String & toString() const
Definition: yatecbase.h:4519
Definition: yateclass.h:949
virtual bool validateCall(NamedList &params, Window *wnd=0)
Definition: yatecbase.h:2748
A regexp matching class.
Definition: yateclass.h:2902
virtual bool clearTable()
Definition: yatecbase.h:869
virtual bool delAccount(const String &account, Window *wnd=0)
Definition: yatecbase.h:2833
static ClientChannel * findActiveChan()
Definition: yatecbase.h:2598
static String s_calltoPrefix
Definition: yatecbase.h:5756
void unlockOther()
Definition: yatecbase.h:1112
String & buildInstanceId(String &dest, const String &inst=String::empty())
Definition: yatecbase.h:4535
virtual bool initializedClient()
Definition: yatecbase.h:2993
void startup(bool ok)
Definition: yatecbase.h:3976
bool canChangeSubject() const
Definition: yatecbase.h:5237
ObjList * skipNull() const
int line() const
Definition: yatecbase.h:2374
ClientDir(const ClientDir &other)
Definition: yatecbase.h:5841
const String & hexDigest()
Definition: yateclass.h:4067
virtual bool handleCallCdr(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3018
ClientAccountList(const char *name, ClientAccount *localContacts=0)
Definition: yatecbase.h:4203
virtual bool handleUserLogin(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3027
NamedList & share()
Definition: yatecbase.h:4769
bool local(bool defVal=false) const
Definition: yatecbase.h:4470
bool getBoolOpt(ClientToggle toggle)
Definition: yatecbase.h:1729
virtual bool imRouting(Message &msg)
Definition: yatecbase.h:1626
Thread support class.
Definition: yateclass.h:5529
RefObject * clientData() const
Definition: yatecbase.h:2278
ObjList & mucs()
Definition: yatecbase.h:3928
void updated(bool on)
Definition: yatecbase.h:5863
void setValue(int val)
Definition: yatecbase.h:195
Message * buildMucRoom(const char *oper)
Definition: yatecbase.h:5266
const String & peerOutFormat() const
Definition: yatecbase.h:2334
A sound file.
Definition: yatecbase.h:5583
virtual bool getOptions(NamedList &items)
Definition: yatecbase.h:793
constant YSTRING(const char *string)
static const char * boolText(bool value)
Definition: yateclass.h:1931
void lockOther()
Definition: yatecbase.h:1106
void setThread(Thread *th)
Definition: yatecbase.h:1119
static const char * statusDisplayText(int status, const char *defVal=0)
Definition: yatecbase.h:5081
bool started() const
Definition: yatecbase.h:5625
virtual bool callLogDelete(const String &billid)
Definition: yatecbase.h:2928
const String & name() const
Definition: yatecbase.h:5792
virtual bool select(Window *wnd, const String &name, const String &item, const String &text=String::empty())
Definition: yatecbase.h:2699
virtual void initializedWindows()
Definition: yatecbase.h:2984
MucRoomMember & resource()
Definition: yatecbase.h:5191
virtual ~UIWidget()
Definition: yatecbase.h:770
A file/directory item.
Definition: yatecbase.h:5775
bool offline() const
Definition: yatecbase.h:4999
Status
Definition: yatecbase.h:4949
bool conference() const
Definition: yatecbase.h:2264
String substr(int offs, int len=-1) const
virtual bool handleResourceSubscribe(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3063
virtual ClientFile * file()
Definition: yatecbase.h:5806
Channel used by client programs.
Definition: yatecbase.h:2104
bool isNoticed() const
Definition: yatecbase.h:2362
void * userObject(const String &name) const
Definition: yatengine.h:386
Configuration file handling.
Definition: yatengine.h:40
ObjList & children()
Definition: yatecbase.h:5849
bool canBuild(const String &type)
Definition: yatecbase.h:958
const String & peerInFormat() const
Definition: yatecbase.h:2341
virtual bool setProperty(const String &name, const String &item, const String &value)
Definition: yatecbase.h:574
virtual bool defaultMsgHandler(Message &msg, int id, bool &stopLogic)
Definition: yatecbase.h:3093
ObjList & groups()
Definition: yatecbase.h:4462
bool online() const
Definition: yatecbase.h:4448
const String & partyName() const
Definition: yatecbase.h:2257
void getContactSection(String &buf)
Definition: yatecbase.h:4508
static Mutex s_soundsMutex
Definition: yatecbase.h:5750
virtual bool setParams(const NamedList &params)
Definition: yatecbase.h:785
static ObjList s_sounds
Definition: yatecbase.h:5745
static String & buildAccountId(String &accId, const String &proto, const String &user, const String &host)
Definition: yatecbase.h:3632
virtual ClientFile * file()
Definition: yatecbase.h:5982
A multiple message receiver.
Definition: yatengine.h:607
int slave() const
Definition: yatecbase.h:2193
virtual bool chooseFile(Window *parent, NamedList &params)
Definition: yatecbase.h:1582
bool remote(bool defVal=false) const
Definition: yatecbase.h:4485
static String s_confName
Definition: yatecbase.h:2612
bool emitDigit(char digit, const String &id=String::empty())
Definition: yatecbase.h:1719
const String & file() const
Definition: yatecbase.h:5646
void populate()
Definition: yatecbase.h:590
virtual bool getText(String &text, bool richText=false)
Definition: yatecbase.h:921
An UI time updater.
Definition: yatecbase.h:5476
const NamedList & clientParams() const
Definition: yatecbase.h:2243
bool startup() const
Definition: yatecbase.h:3969
An abstract communication channel.
Definition: yatephone.h:1655
virtual bool addTableRow(const String &item, const NamedList *data=0, bool atStart=false)
Definition: yatecbase.h:803
virtual bool createSound(const char *name, const char *file, const char *device=0)
Definition: yatecbase.h:1702
ObjList & shared()
Definition: yatecbase.h:4816
bool muted() const
Definition: yatecbase.h:2355
virtual bool updateContact(const NamedList &contact, bool save, bool update)
Definition: yatecbase.h:2863
virtual bool canClose()
Definition: yatecbase.h:651
ClientAccount * localContacts() const
Definition: yatecbase.h:4224
virtual bool handleContactInfo(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3081
ObjList & slaves()
Definition: yatecbase.h:2201
static Thread * current()
static void setLogicsTick()
Definition: yatecbase.h:1862
ClientDir(const char *name)
Definition: yatecbase.h:5833
virtual bool callRouting(Message &msg)
Definition: yatecbase.h:1619
bool setAudio(bool ok)
Definition: yatecbase.h:5028
bool setStatus(int stat)
Definition: yatecbase.h:5056
virtual ClientDir * directory()
Definition: yatecbase.h:5929
virtual void destruct()
bool subscriptionFrom() const
Definition: yatecbase.h:4420
virtual bool insertResource(ClientResource *res)
Definition: yatecbase.h:5446
virtual void engineStart(Message &msg)
Definition: yatecbase.h:3100
virtual bool updateTableRows(const NamedList *data, bool atStart=false)
Definition: yatecbase.h:825
Encapsulation for an URI.
Definition: yateclass.h:4920
virtual bool updateProviders(const NamedList &provider, bool save, bool update)
Definition: yatecbase.h:2910
ClientToggle
Definition: yatecbase.h:1030
bool isLocalContact(const String &id) const
Definition: yatecbase.h:4239
ClientContact * contact() const
Definition: yatecbase.h:3935
bool haveShare() const
Definition: yatecbase.h:4776
ObjList * find(const GenObject *obj) const
int lookup(const char *str, const TokenDict *tokens, int defvalue=0, int base=0)
const String & name() const
Definition: yatecbase.h:2648
virtual bool action(Window *wnd, const String &name, NamedList *params=0)
Definition: yatecbase.h:2678
void setOnline(bool on)
Definition: yatecbase.h:4455
const String & master() const
Definition: yatecbase.h:2236
void destruct(GenObject *obj)
Definition: yateclass.h:933
virtual bool imIncoming(Message &msg)
Definition: yatecbase.h:2729
static bool exiting()
Definition: yatengine.h:1429
A directory.
Definition: yatecbase.h:5825
virtual bool callStart(NamedList &params, Window *wnd=0, const String &cmd=String::empty())
Definition: yatecbase.h:2759
virtual bool toggle(Window *wnd, const String &name, bool active)
Definition: yatecbase.h:2688
static const String & cdrRemoteParty(const NamedList &params)
Definition: yatecbase.h:3159
virtual bool help(const String &action, Window *wnd)
Definition: yatecbase.h:2965
bool changeFlagCheck(u_int32_t mask, bool ok)
Definition: yatecbase.h:129
bool canInvite() const
Definition: yatecbase.h:5244
virtual bool callContact(NamedList *params=0, Window *wnd=0)
Definition: yatecbase.h:2900
void set(u_int32_t mask)
Definition: yatecbase.h:93
An abstract call endpoint.
Definition: yatephone.h:1127
virtual bool callLogCreateContact(const String &billid)
Definition: yatecbase.h:2956
Capability
Definition: yatecbase.h:4963
virtual bool editAccount(bool newAcc, NamedList *params, Window *wnd=0)
Definition: yatecbase.h:2815
const String & subscriptionStr() const
Definition: yatecbase.h:4413
bool active() const
Definition: yatecbase.h:693
bool online() const
Definition: yatecbase.h:4992
static int lookup(const char *notif, int def=Unknown)
Definition: yatecbase.h:2430
A time holding class.
Definition: yateclass.h:3536
bool popup() const
Definition: yatecbase.h:707
Flags32(u_int32_t value)
Definition: yatecbase.h:78
ClientAccount * account()
Definition: yatecbase.h:4385
Subscription
Definition: yatecbase.h:4355
virtual bool setBusy(bool on)
Definition: yatecbase.h:929
MsgID
Definition: yatecbase.h:1004
Flags32 & caps()
Definition: yatecbase.h:5020
virtual bool handleUserNotify(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3036
Flags32()
Definition: yatecbase.h:70
static String uriUnescape(const char *str, int *errptr=0)
const String & name() const
Definition: yatecbase.h:777
A message container class.
Definition: yatengine.h:312
An abstract user interface window.
Definition: yatecbase.h:253
static bool exiting()
Definition: yatecbase.h:1757
virtual bool callLogCall(const String &billid, Window *wnd=0)
Definition: yatecbase.h:2948
virtual bool getProperty(const String &name, const String &item, String &value)
Definition: yatecbase.h:584
const String & protocol() const
Definition: yatecbase.h:3948
bool active() const
Definition: yatecbase.h:2348
bool native() const
Definition: yatecbase.h:5618
const NamedList & params() const
Definition: yatecbase.h:5975
A MUC room member.
Definition: yatecbase.h:5107
bool available() const
Definition: yatecbase.h:5214
void reset(u_int32_t mask)
Definition: yatecbase.h:100
static bool s_dropConfPeer
Definition: yatecbase.h:2618
bool subscriptionTo() const
Definition: yatecbase.h:4427
virtual ClientDir * directory()
Definition: yatecbase.h:5799
SlaveType
Definition: yatecbase.h:2136
u_int32_t flag(u_int32_t mask) const
Definition: yatecbase.h:108
bool hasChat() const
Definition: yatecbase.h:3955
void getReconnPeer(String &buf)
Definition: yatecbase.h:2401
bool canChat() const
Definition: yatecbase.h:5223
virtual void idleTimerTick(Time &time)
Definition: yatecbase.h:3214
bool setPriority(int prio)
Definition: yatecbase.h:5044
ClientSound(const char *name, const char *file, const char *device=0)
Definition: yatecbase.h:5594
virtual bool handleUserRoster(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3045
virtual bool addLines(const NamedList &lines, unsigned int max, bool atStart=false)
Definition: yatecbase.h:903
virtual bool acceptAccount(NamedList *params, Window *wnd=0)
Definition: yatecbase.h:2824
A Channel driver module.
Definition: yatephone.h:2171
static void splitContactId(const String &src, String &account)
Definition: yatecbase.h:4859
virtual bool delContact(const String &contact, Window *wnd=0)
Definition: yatecbase.h:2891
virtual bool getTableRow(const String &item, NamedList *data=0)
Definition: yatecbase.h:862
virtual bool callIncoming(Message &msg, const String &dest)
Definition: yatecbase.h:2739
constant YATOM(const char *string)
void buildIdHash(String &buf, const String &prefix=String::empty())
Definition: yatecbase.h:4543
virtual void loadedWindows()
Definition: yatecbase.h:3494
void setClientData(RefObject *obj=0)
Definition: yatecbase.h:2286
virtual bool getSelect(String &item)
Definition: yatecbase.h:885
ClientFile(const ClientFile &other)
Definition: yatecbase.h:5960
A named string class.
Definition: yateclass.h:3111
static String & buildContactId(String &dest, const String &account, const String &contact)
Definition: yatecbase.h:4848
virtual bool select(Window *wnd, const String &name, const NamedList &items)
Definition: yatecbase.h:2710
bool isChatWnd(Window *wnd)
Definition: yatecbase.h:4553
DataSource * getSource(const String &type=CallEndpoint::audioType()) const
bool stereo() const
Definition: yatecbase.h:5670
ClientFileItem(const char *name)
Definition: yatecbase.h:5784
virtual bool formatDateTime(String &dest, unsigned int secs, const char *format, bool utc=false)
Definition: yatecbase.h:1749
The client's default logic.
Definition: yatecbase.h:3233
bool hasReconnPeer()
Definition: yatecbase.h:2409
const String & device() const
Definition: yatecbase.h:5632
virtual ~ClientSound()
Definition: yatecbase.h:5602
NamedList & params()
Definition: yatecbase.h:5968
bool master() const
Definition: yatecbase.h:700
ObjList & resources()
Definition: yatecbase.h:4441
An account's MUC room contact.
Definition: yatecbase.h:5171
virtual bool editContact(bool newCont, NamedList *params=0, Window *wnd=0)
Definition: yatecbase.h:2882
ObjList & accounts()
Definition: yatecbase.h:4217
const Flags32 & operator=(int value)
Definition: yatecbase.h:152
virtual void destruct()
Definition: yatecbase.h:5608
void removeSlave(const String &sid)
Definition: yatecbase.h:2227
void visible(bool yes)
Definition: yatecbase.h:686
const String & id() const
Definition: yatecbase.h:658
void changeFlag(u_int32_t mask, bool on)
Definition: yatecbase.h:116
bool updated() const
Definition: yatecbase.h:5856
A named string container class.
Definition: yateclass.h:4553
void setRepeat(unsigned int count)
Definition: yatecbase.h:5663
virtual bool callLogClear(const String &table, const String &direction)
Definition: yatecbase.h:2939
Ephemeral mutex or semaphore locking object.
Definition: yateclass.h:5357
ObjList & contacts()
Definition: yatecbase.h:3921
static u_int32_t secNow()
const String & party() const
Definition: yatecbase.h:2250
static const char * lookup(int notif, const char *def=0)
Definition: yatecbase.h:2439
virtual void exitingClient()
Definition: yatecbase.h:3000
Role
Definition: yatecbase.h:5127
void setDockedChat(bool on)
Definition: yatecbase.h:4499
static bool valid()
Definition: yatecbase.h:1544
bool ownMember(const String &item) const
Definition: yatecbase.h:5207
TrayIconType
Definition: yatecbase.h:1053
virtual ClientResource * status(bool ref=false)
Definition: yatecbase.h:5293
virtual bool acceptContact(NamedList *params, Window *wnd=0)
Definition: yatecbase.h:2872
NamedList & addParam(NamedString *param)
ObjList * skipNext() const
virtual MucRoom * mucRoom()
Definition: yatecbase.h:4526
virtual void loadedWindows()
Definition: yatecbase.h:2978
A client account list.
Definition: yatecbase.h:4193
unsigned int slavesCount() const
Definition: yatecbase.h:2208
ClientResource(const char *id, const char *name=0, bool audio=true)
Definition: yatecbase.h:4976
Definition: yateclass.h:217
const NamedList & params() const
Definition: yatecbase.h:3914
String & toLower()
void device(const char *dev)
Definition: yatecbase.h:5639
void init()
Definition: yatecbase.h:600
int value() const
Definition: yatecbase.h:188
virtual const String & toString() const
Definition: yatecbase.h:5813
const String & accountName() const
Definition: yatecbase.h:4392
A C-style string handling class.
Definition: yateclass.h:1832
static const String & cdrRemoteParty(const NamedList &params, bool outgoing)
Definition: yatecbase.h:3151
String m_password
Definition: yatecbase.h:5460
A 32 bit length list of flags.
Definition: yatecbase.h:64
virtual bool getSelect(NamedList &items)
Definition: yatecbase.h:893
Definition: yateclass.h:683
static int lookup(const ObjList &list, const String &name, int defVal=0)
Definition: yatecbase.h:219
virtual const String & toString() const
Definition: yatecbase.h:3983
A named integer value.
Definition: yatecbase.h:163
bool startSkip(const char *what, bool wordBreak=true, bool caseInsensitive=false)
virtual bool insertTableRow(const String &item, const String &before, const NamedList *data=0)
Definition: yatecbase.h:835
void setLocal(bool on)
Definition: yatecbase.h:4477
An object list class.
Definition: yateclass.h:1229
virtual MucRoom * mucRoom()
Definition: yatecbase.h:5285
Notification
Definition: yatecbase.h:2113
bool setStatusText(const String &text=String::empty())
Definition: yatecbase.h:5068
NamedInt(const NamedInt &other)
Definition: yatecbase.h:180
virtual bool setMultipleRows(const NamedList &data, const String &prefix=String::empty())
Definition: yatecbase.h:812
static Message * buildMessage(const char *msg, const String &account, const char *oper=0)
void YNOCOPY(class type)
void YCLASS(class type, class base)
virtual bool calltoLoaded()
Definition: yatecbase.h:2972
ClientResource & resource() const
Definition: yatecbase.h:3996
virtual const String & toString() const
static const String & empty()
UIWidget(const char *name=0)
Definition: yatecbase.h:763
virtual bool setTableRow(const String &item, const NamedList *data)
Definition: yatecbase.h:853
bool visible() const
Definition: yatecbase.h:679
const String & activeId() const
Definition: yatecbase.h:2520
int find(char what, unsigned int offs=0) const
bool isChatVisible()
Definition: yatecbase.h:4641
static const String & device()
Definition: yatecbase.h:2551
virtual const String & toString() const
Base class for all client logics.
Definition: yatecbase.h:2633
const String & dataDir() const
Definition: yatecbase.h:4136
bool ownMember(MucRoomMember *item) const
Definition: yatecbase.h:5199
virtual bool handleUiAction(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3009
A client contact's resource.
Definition: yatecbase.h:4941
A file.
Definition: yatecbase.h:5941
virtual bool setText(const String &text, bool richText=false)
Definition: yatecbase.h:912
virtual bool handleResourceNotify(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3054
virtual bool callLogUpdate(const NamedList &params, bool save, bool update)
Definition: yatecbase.h:2920
GenObject * get() const
Definition: yateclass.h:1266
Base Driver with client specific functions.
Definition: yatecbase.h:2502
Mutex support.
Definition: yateclass.h:5131
virtual bool updateAccount(const NamedList &account, bool login, bool save)
Definition: yatecbase.h:2843
A standard MD5 digest calculator.
Definition: yateclass.h:4213
A client contact.
Definition: yatecbase.h:4346
int priority() const
Definition: yatecbase.h:2655
bool setFileTransfer(bool ok)
Definition: yatecbase.h:5036
Definition: yateclass.h:830
DurationUpdate(ClientLogic *logic, bool owner, const char *id, const char *name, unsigned int start=Time::secNow())
Definition: yatecbase.h:5489
void setUri(const char *u)
Definition: yatecbase.h:4406
An account.
Definition: yatecbase.h:3884
void change(u_int32_t value)
Definition: yatecbase.h:140
MucRoomMember(const char *id, const char *nick, const char *uri=0)
Definition: yatecbase.h:5141
const char * statusName() const
Definition: yatecbase.h:5006
static int lookupSlaveType(const char *notif, int def=SlaveNone)
Definition: yatecbase.h:2448
const String & context() const
Definition: yatecbase.h:672
void file(const char *filename, bool stereo)
Definition: yatecbase.h:5655
Class that runs the User Interface.
Definition: yatecbase.h:993
bool canChatPrivate() const
Definition: yatecbase.h:5230
const char * text() const
Definition: yatecbase.h:5013
ClientFileItem * findChildName(const String &name)
Definition: yatecbase.h:5920
int line() const
Definition: yatecbase.h:1302