26 #error C++ is required
29 #include <yatephone.h>
48 class ClientAccountList;
93 inline void set(u_int32_t mask)
94 { m_flags = m_flags | mask; }
101 { m_flags = m_flags & ~mask; }
108 inline u_int32_t
flag(u_int32_t mask)
const
109 {
return (m_flags & mask); }
130 if ((0 != flag(mask)) == ok)
146 inline operator u_int32_t()
const
153 { m_flags = value;
return *
this; }
173 :
String(name), m_value(val)
181 :
String(other), m_value(other.value())
210 static void clearValue(
ObjList& list,
int val);
221 return o ? (
static_cast<NamedInt*
>(o->
get()))->value() : defVal;
235 if (ni->
value() == val)
263 explicit Window(
const char*
id = 0);
274 virtual const String& toString()
const;
280 virtual void title(
const String& text);
286 virtual void context(
const String& text);
293 virtual bool setParams(
const NamedList& params);
299 virtual void setOver(
const Window* parent) = 0;
306 virtual bool hasElement(
const String& name) = 0;
314 virtual bool setActive(
const String& name,
bool active) = 0;
322 virtual bool setFocus(
const String& name,
bool select =
false) = 0;
330 virtual bool setShow(
const String& name,
bool visible) = 0;
339 virtual bool setText(
const String& name,
const String& text,
340 bool richText =
false) = 0;
348 virtual bool setCheck(
const String& name,
bool checked) = 0;
356 virtual bool setSelect(
const String& name,
const String& item) = 0;
364 virtual bool setUrgent(
const String& name,
bool urgent) = 0;
372 virtual bool hasOption(
const String& name,
const String& item) = 0;
382 virtual bool addOption(
const String& name,
const String& item,
bool atStart =
false,
399 virtual bool delOption(
const String& name,
const String& item) = 0;
409 virtual bool addLines(
const String& name,
const NamedList* lines,
unsigned int max,
410 bool atStart =
false);
420 virtual bool addTableRow(
const String& name,
const String& item,
421 const NamedList* data = 0,
bool atStart =
false);
440 virtual bool insertTableRow(
const String& name,
const String& item,
449 virtual bool delTableRow(
const String& name,
const String& item);
468 virtual bool updateTableRow(
const String& name,
const String& item,
469 const NamedList* data = 0,
bool atStart =
false);
482 virtual bool updateTableRows(
const String& name,
const NamedList* data,
483 bool atStart =
false);
499 virtual bool clearTable(
const String& name);
507 virtual bool setBusy(
const String& name,
bool on) = 0;
516 virtual bool getText(
const String& name,
String& text,
bool richText =
false) = 0;
524 virtual bool getCheck(
const String& name,
bool& checked) = 0;
532 virtual bool getSelect(
const String& name,
String& item) = 0;
548 virtual bool buildMenu(
const NamedList& params) = 0;
556 virtual bool removeMenu(
const NamedList& params) = 0;
565 virtual bool setImage(
const String& name,
const String& image,
bool fit =
false) = 0;
604 m_initialized =
true;
610 virtual void show() = 0;
615 virtual void hide() = 0;
622 virtual void size(
int width,
int height) = 0;
629 virtual void move(
int x,
int y) = 0;
636 virtual void moveRel(
int dx,
int dy) = 0;
643 virtual bool related(
const Window* wnd)
const;
645 virtual void menu(
int x,
int y) = 0;
665 inline const String& title()
const
673 {
return m_context; }
680 {
return m_visible; }
687 {
if (yes) show();
else hide(); }
718 virtual bool createDialog(
const String& name,
const String& title,
726 virtual bool closeDialog(
const String& name) = 0;
734 static bool isValidParamPrefix(
const String& prefix);
737 virtual void doPopulate() = 0;
738 virtual void doInit() = 0;
778 {
return toString(); }
804 bool atStart =
false)
959 {
return 0 != m_types.find(type); }
968 virtual void* create(
const String& type,
const char* name,
NamedList* params = 0) = 0;
979 static void* build(
const String& type,
const char* name,
NamedList* params = 0,
980 const char* factory = 0);
1035 OptActivateLastOutCall,
1036 OptActivateLastInCall,
1037 OptActivateCallOnSelect,
1041 OptAddAccountOnStartup,
1055 TrayIconInfo = 1000,
1056 TrayIconIncomingChat = 3000,
1057 TrayIconNotification = 5000,
1058 TrayIconIncomingCall = 10000,
1065 explicit Client(
const char *name = 0);
1076 virtual bool startup();
1086 virtual void cleanup();
1091 virtual void main() = 0;
1096 virtual void lock() = 0;
1101 virtual void unlock() = 0;
1107 {
if (!m_oneThread) lock(); }
1113 {
if (!m_oneThread) unlock(); }
1120 { m_clientThread = th; }
1125 virtual void allHidden() = 0;
1132 void loadUI(
const char* file = 0,
bool init =
true);
1137 virtual void quit() = 0;
1144 bool openUrlSafe(
const String& url);
1151 virtual bool openUrl(
const String& url) = 0;
1159 virtual bool received(
Message& msg,
int id);
1168 virtual bool createWindowSafe(
const String& name,
1191 virtual bool createObject(
void** dest,
const String& type,
const char* name,
1200 virtual bool closeWindow(
const String& name,
bool hide =
true);
1216 virtual bool debugHook(
bool active);
1223 virtual bool addToLog(
const String& text);
1231 virtual bool setStatus(
const String& text,
Window* wnd = 0);
1239 bool setStatusLocked(
const String& text,
Window* wnd = 0);
1268 virtual bool toggle(
Window* wnd,
const String& name,
bool active);
1296 {
return m_oneThread; }
1309 void line(
int newLine);
1313 bool setFocus(
const String& name,
bool select =
false,
Window* wnd = 0,
Window* skip = 0);
1315 bool setText(
const String& name,
const String& text,
bool richText =
false,
1333 bool addOption(
const String& name,
const String& item,
bool atStart,
1347 bool addLines(
const String& name,
const NamedList* lines,
unsigned int max,
1348 bool atStart =
false,
Window* wnd = 0,
Window* skip = 0);
1351 bool atStart =
false,
Window* wnd = 0,
Window* skip = 0);
1374 bool insertTableRow(
const String& name,
const String& item,
1396 bool atStart =
false,
Window* wnd = 0,
Window* skip = 0);
1411 bool updateTableRows(
const String& name,
const NamedList* data,
bool atStart =
false,
1494 virtual bool setImage(
const String& name,
const String& image,
1505 virtual bool setImageFit(
const String& name,
const String& image,
1517 virtual bool setProperty(
const String& name,
const String& item,
const String& value,
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; }
1545 {
return self() && (
self()->isUIThread() || !(exiting() ||
Engine::exiting())); }
1552 static bool isClientMsg(
Message& msg);
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();
1572 bool postpone(
const Message& msg,
int id,
bool copyUserData =
false);
1595 virtual bool setClientParam(
const String& param,
const String& value,
1596 bool save,
bool update);
1604 virtual bool backspace(
const String& name,
Window* wnd = 0);
1613 void installRelay(
const char* name,
int id,
int prio);
1633 virtual bool imExecute(
Message& msg);
1645 virtual bool buildIncomingChannel(
Message& msg,
const String& dest);
1652 virtual bool buildOutgoingChannel(
NamedList& params);
1669 void callAnswer(
const String&
id,
bool setActive =
true);
1678 void callTerminate(
const String&
id,
const char* reason = 0,
const char* error = 0);
1693 virtual bool ringer(
bool in,
bool on);
1702 virtual bool createSound(
const char* name,
const char* file,
const char* device = 0)
1720 char s[2] = {digit,0};
1721 return emitDigits(s,
id);
1730 {
return toggle < OptCount ? m_toggles[toggle] :
false; }
1739 bool setBoolOpt(ClientToggle toggle,
bool value,
bool updateUi =
false);
1758 {
return s_exiting; }
1765 static bool getActive(
const String& name);
1775 static Message* buildMessage(
const char* msg,
const String& account,
1776 const char* oper = 0);
1785 static Message* buildNotify(
bool online,
const String& account,
1798 static Message* buildSubscribe(
bool request,
bool ok,
const String& account,
1799 const String& contact,
const char* proto = 0);
1809 static Message* buildUserRoster(
bool update,
const String& account,
1810 const String& contact,
const char* proto = 0);
1841 const char* name = 0,
NamedList* params = 0);
1857 static ClientToggle getBoolOpt(
const String& name);
1863 { s_idleLogicsTick =
true; }
1872 static void appendEscape(
String& buf,
ObjList& list,
char sep =
',',
bool force =
false);
1881 static ObjList* splitUnescape(
const String& buf,
char sep =
',',
bool emptyOk =
false);
1888 static void removeChars(
String& buf,
const char* chars);
1898 static void fixPhoneNumber(
String& number,
const char* chars = 0);
1909 static bool addTrayIcon(
const String& wndName,
int prio,
NamedList* params);
1919 static bool removeTrayIcon(
const String& wndName,
const String& name);
1928 static bool updateTrayIcon(
const String& wndName);
1942 static void plain2html(
String& buf,
bool spaceEol =
false);
1973 static int decodeFlags(
const TokenDict* dict,
const String& flags,
int defVal = 0);
1982 static void addPathSep(
String& dest,
const String& path,
char sep = 0);
1988 static void fixPathSep(
String& path);
1998 static bool removeEndsWithPathSep(
String& dest,
const String& path,
char sep = 0);
2008 static bool getLastNameInPath(
String& dest,
const String& path,
char sep = 0);
2022 static bool removeLastNameInPath(
String& dest,
const String& path,
char sep = 0,
2030 static bool addToLogFormatted(
const char* format, ...);
2040 static Regexp s_notSelected;
2043 static Regexp s_guidRegexp;
2045 static String s_skinPath;
2046 static String s_soundPath;
2048 static String s_ringInName;
2050 static String s_ringOutName;
2052 static String s_statusWidget;
2054 static String s_debugWidget;
2056 static String s_toggles[OptCount];
2058 static int s_maxConfPeers;
2060 static bool s_engineStarted;
2069 virtual bool createWindow(
const String& name,
2071 virtual void loadWindows(
const char* file = 0) = 0;
2072 virtual void initWindows();
2073 virtual void initClient();
2074 virtual void exitClient()
2076 virtual bool isUIThread()
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();
2084 static bool s_exiting;
2090 bool m_toggles[OptCount];
2092 ClientLogic* m_defaultLogic;
2093 static Client* s_client;
2094 static int s_changing;
2095 static ObjList s_logics;
2096 static bool s_idleLogicsTick;
2097 Thread* m_clientThread;
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);
2187 void callAnswer(
bool setActive =
true);
2202 {
return m_slaves; }
2210 return m_slaves.count();
2219 if (!m_slaves.find(sid))
2220 m_slaves.append(
new String(sid));
2229 m_slaves.remove(sid);
2237 {
return m_master; }
2244 {
return m_clientParams; }
2258 {
return m_partyName ? m_partyName : m_party; }
2265 {
return m_conference; }
2272 {
return m_transferId; }
2279 {
return m_clientData; }
2288 if (obj && obj->ref())
2298 bool setMedia(
bool open =
false,
bool replace =
false);
2306 bool setActive(
bool active,
bool update =
true);
2314 bool setMuted(
bool on,
bool update =
true);
2335 {
return m_peerOutFormat; }
2342 {
return m_peerInFormat; }
2349 {
return m_active; }
2363 {
return m_noticed; }
2381 void line(
int newLine);
2393 void update(
int notif,
bool chan =
true,
2394 bool updatePeer =
true,
const char* engineMsg = 0,
2395 bool minimal =
false,
bool data =
false);
2410 {
return 0 != getReconnPeer(
false); }
2422 void dropReconnPeer(
const char* reason = 0);
2430 static int lookup(
const char* notif,
int def = Unknown)
2439 static const char*
lookup(
int notif,
const char* def = 0)
2462 virtual void destroyed();
2463 virtual void connected(
const char* reason);
2464 virtual void disconnected(
bool final,
const char* reason);
2466 inline bool peerHasSource(
Message& msg) {
2474 void checkSilence();
2510 virtual void initialize() = 0;
2512 virtual void msgTimer(
Message& msg);
2513 virtual bool msgRoute(
Message& msg);
2514 virtual bool received(
Message& msg,
int id);
2521 {
return m_activeId; }
2545 {
return s_driver; }
2552 {
return s_device; }
2558 static void dropCalls(
const char* reason = 0);
2577 static bool setConference(
const String&
id,
bool in,
const String* confName = 0,
2578 bool buildFromChan =
false);
2599 {
return self() ? findChan(
self()->activeId()) : 0; }
2607 static void dropChan(
const String& chan,
const char* reason = 0,
bool peer =
false);
2662 virtual const String& toString()
const;
2669 bool setParams(
const NamedList& params);
2722 bool save,
bool update)
2769 virtual bool line(
const String& name,
Window* wnd = 0);
2778 virtual bool display(
NamedList& params,
bool widget,
Window* wnd = 0);
2786 virtual bool backspace(
const String& name,
Window* wnd = 0);
2794 virtual bool command(
const String& name,
Window* wnd = 0);
2806 virtual bool debug(
const String& name,
bool active,
Window* wnd = 0);
3109 virtual bool addDurationUpdate(
DurationUpdate* duration,
bool autoDelete =
false);
3117 virtual bool removeDurationUpdate(
const String& name,
bool delObj =
false);
3125 virtual bool removeDurationUpdate(
DurationUpdate* duration,
bool delObj =
false);
3138 virtual void clearDurationUpdate();
3152 {
return outgoing ? params[
YSTRING(
"called")] : params[
YSTRING(
"caller")]; }
3161 if (dir ==
YSTRING(
"incoming"))
3162 return cdrRemoteParty(params,
true);
3163 if (dir ==
YSTRING(
"outgoing"))
3164 return cdrRemoteParty(params,
false);
3172 static void initStaticData();
3195 static const char* s_provParams[];
3199 static Mutex s_protocolsMutex;
3218 Mutex m_durationMutex;
3243 explicit DefaultLogic(
const char* name =
"default",
int prio = -100);
3266 virtual bool toggle(
Window* wnd,
const String& name,
bool active);
3296 virtual bool setClientParam(
const String& param,
const String& value,
3297 bool save,
bool update);
3303 virtual bool imIncoming(
Message& msg);
3312 virtual bool callIncoming(
Message& msg,
const String& dest);
3349 virtual bool editAccount(
bool newAcc,
NamedList* params,
Window* wnd = 0);
3365 virtual bool delAccount(
const String& account,
Window* wnd = 0);
3374 virtual bool updateAccount(
const NamedList& account,
bool login,
bool save);
3382 virtual bool loginAccount(
const NamedList& account,
bool login);
3392 virtual bool updateContact(
const NamedList& contact,
bool save,
bool update);
3409 virtual bool editContact(
bool newCont,
NamedList* params = 0,
Window* wnd = 0);
3417 virtual bool delContact(
const String& contact,
Window* wnd = 0);
3434 virtual bool updateProviders(
const NamedList& provider,
bool save,
bool update);
3443 virtual bool callLogUpdate(
const NamedList& params,
bool save,
bool update);
3450 virtual bool callLogDelete(
const String& billid);
3460 virtual bool callLogClear(
const String& table,
const String& direction);
3468 virtual bool callLogCall(
const String& billid,
Window* wnd = 0);
3475 virtual bool callLogCreateContact(
const String& billid);
3489 virtual bool calltoLoaded();
3500 virtual void initializedWindows();
3508 virtual bool initializedClient();
3514 virtual void exitingClient();
3522 virtual bool handleUiAction(
Message& msg,
bool& stopLogic);
3530 virtual bool handleCallCdr(
Message& msg,
bool& stopLogic);
3538 virtual bool handleUserLogin(
Message& msg,
bool& stopLogic);
3546 virtual bool handleUserNotify(
Message& msg,
bool& stopLogic);
3554 virtual bool handleUserRoster(
Message& msg,
bool& stopLogic);
3562 virtual bool handleResourceNotify(
Message& msg,
bool& stopLogic);
3570 virtual bool handleResourceSubscribe(
Message& msg,
bool& stopLogic);
3578 virtual bool handleClientChanUpdate(
Message& msg,
bool& stopLogic);
3586 virtual bool handleContactInfo(
Message& msg,
bool& stopLogic);
3597 virtual bool defaultMsgHandler(
Message& msg,
int id,
bool& stopLogic);
3604 virtual void updateSelectedChannel(
const String* item = 0);
3610 virtual void engineStart(
Message& msg);
3622 virtual void closeInCallNotification(
const String&
id);
3634 accId = proto +
":" + user +
"@" + host;
3644 virtual void idleTimerTick(
Time& time);
3651 virtual bool enableCallActions(
const String&
id);
3666 virtual void channelSelectionChanged(
const String& old);
3675 virtual void fillContactEditActive(
NamedList& list,
bool active,
const String* item = 0,
3684 virtual void fillLogContactActive(
NamedList& list,
bool active,
const String* item = 0);
3693 virtual bool clearList(
const String& action,
Window* wnd);
3714 virtual bool deleteCheckedItems(
const String& list,
Window* wnd,
bool confirm);
3725 virtual bool deleteSelectedItem(
const String& action,
Window* wnd,
bool checked =
false);
3751 virtual bool handleFileTransferNotify(
Message& msg,
bool& stopLogic);
3759 virtual bool handleUserData(
Message& msg,
bool& stopLogic);
3767 virtual bool handleFileInfo(
Message& msg,
bool& stopLogic);
3776 virtual void notifyGenericError(
const String& text,
3779 const char* title =
"Error");
3788 virtual void notifyNoAudio(
bool show,
bool micOk =
false,
bool speakerOk =
false,
3797 virtual void updateChatRoomsContactList(
bool load,
ClientAccount* acc,
3805 virtual void joinRoom(
MucRoom* room,
bool force =
false);
3807 String m_selectedChannel;
3808 String m_transferInitiated;
3813 bool updateAccount(
const NamedList& account,
bool save,
3818 bool handleDialogAction(
const String& name,
bool& retVal,
Window* wnd);
3820 bool handleChatContactAction(
const String& name,
Window* wnd);
3822 bool handleChatContactEditOk(
const String& name,
Window* wnd);
3824 bool handleChatRoomEditOk(
const String& name,
Window* wnd);
3828 bool handleMucInviteOk(
Window* wnd);
3839 const char* notif =
"notification");
3843 bool newContact =
true);
3845 bool handleNotificationAreaAction(
const String& action,
Window* wnd);
3849 bool handleAccCredInput(
Window* wnd,
const String& name,
bool inputPwd);
3851 bool handleChanShowExtra(
Window* wnd,
bool show,
const String& chan,
bool conf);
3853 bool handleChanItemConfTransfer(
bool conf,
const String& name,
Window* wnd);
3863 bool handleFileShareDrop(
bool askOnly,
Window* wnd,
const String& name,
3869 bool handleDrop(
bool askOnly,
Window* wnd,
const String& name,
3876 FtManager* m_ftManager;
3899 explicit ClientAccount(
const char* proto,
const char* user,
const char* host,
3915 {
return m_params; }
3922 {
return m_contacts; }
3936 {
return m_contact; }
3949 {
return m_params[
YSTRING(
"protocol")]; }
3956 {
return protocol() ==
YSTRING(
"jabber"); }
3963 {
return protocol() ==
YSTRING(
"jabber"); }
3970 {
return m_params.getBoolValue(
YSTRING(
"enabled"),
true); }
3984 {
return m_params; }
3997 {
return *m_resource; }
4012 bool save(
bool ok =
true,
bool savePwd =
true);
4031 const String* skipId = 0,
bool ref =
false);
4057 virtual MucRoom* findRoom(
const String&
id,
bool ref =
false);
4065 virtual MucRoom* findRoomByUri(
const String& uri,
bool ref =
false);
4083 const char* uri = 0);
4105 virtual void clearRooms(
bool saved,
bool temp);
4113 virtual Message* userlogin(
bool login,
const char* msg =
"user.login");
4124 const char* msg =
"user.data");
4130 virtual void fillItemParams(
NamedList& list);
4137 {
return m_params[
YSTRING(
"datadirectory")]; }
4146 virtual bool setupDataDir(
String* errStr = 0,
bool saveAcc =
true);
4156 const char* file =
"account.conf");
4170 virtual bool clearDataDir(
String* errStr = 0);
4177 virtual void destroyed();
4179 virtual void appendContact(
ClientContact* contact,
bool muc =
false);
4205 m_localContacts(localContacts)
4218 {
return m_accounts; }
4225 {
return m_localContacts; }
4240 {
return m_localContacts && m_localContacts->findContact(
id); }
4293 virtual MucRoom* findRoom(
const String&
id,
bool ref =
false);
4301 virtual MucRoom* findRoomByMember(
const String&
id,
bool ref =
false);
4331 virtual void removeAccount(
const String&
id);
4338 ClientAccount* m_localContacts;
4368 const char* uri = 0);
4379 const char* uri = 0);
4414 {
return m_subscription; }
4421 {
return 0 != m_sub.flag(SubFrom); }
4428 {
return 0 != m_sub.flag(SubTo); }
4435 bool setSubscription(
const String& value);
4442 {
return m_resources; }
4449 {
return m_online || 0 != m_resources.skipNull(); }
4463 {
return m_groups; }
4470 inline bool local(
bool defVal =
false)
const
4471 {
return m_params.getBoolValue(
YSTRING(
"local"),defVal); }
4485 inline bool remote(
bool defVal =
false)
const
4486 {
return m_params.getBoolValue(
YSTRING(
"remote"),defVal); }
4536 {
return buildContactInstanceId(dest,m_id,inst); }
4554 {
return wnd && wnd->
toString() == m_chatWndName; }
4566 virtual void flashChat(
bool on =
true);
4584 virtual void getChatInput(
String& text,
const String& name =
"message");
4592 const String& name =
"message");
4600 virtual void getChatHistory(
String& text,
bool richText =
false,
4601 const String& name =
"history");
4609 virtual void setChatHistory(
const String& text,
bool richText =
false,
4610 const String& name =
"history");
4619 const String& name =
"history");
4635 virtual void setChatProperty(
const String& name,
const String& prop,
const String& value);
4642 {
return Client::self() && Client::self()->getVisible(m_chatWndName); }
4650 virtual bool showChat(
bool visible,
bool active =
false);
4663 virtual void createChatWindow(
bool force =
false,
const char* name = 0);
4671 virtual void updateChatWindow(
const NamedList& params,
const char* title = 0,
4672 const char* icon = 0);
4678 virtual bool isChatActive();
4683 void destroyChatWindow();
4697 virtual bool appendGroup(
const String& group);
4704 virtual bool removeGroup(
const String& group);
4741 virtual ClientResource* findFileTransferResource(
bool ref =
false);
4763 virtual bool removeResource(
const String&
id);
4777 {
return 0 != m_share.getParam(0); }
4782 virtual void updateShare();
4787 virtual void saveShare();
4792 virtual void clearShare();
4802 virtual bool setShareDir(
const String& name,
const String& path,
bool save =
true);
4810 virtual bool removeShare(
const String& name,
bool save =
true);
4817 {
return m_shared; }
4823 bool haveShared()
const;
4831 virtual ClientDir* getShared(
const String& name,
bool create =
false);
4860 int pos = src.
find(
'|');
4874 static void splitContactInstanceId(
const String& src,
String& account,
4886 dest << cId <<
"|" << inst.
uriEscape(
'|');
4891 static String s_chatPrefix;
4893 static String s_dockedChatWnd;
4895 static String s_dockedChatWidget;
4899 static String s_chatInput;
4916 void removeFromOwner();
4921 virtual void destroyed();
4964 CapAudio = 0x00000001,
4965 CapFileTransfer = 0x00000002,
4966 CapFileInfo = 0x00000004,
4967 CapRsm = 0x00000008,
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)
4993 {
return m_status > Connecting; }
5000 {
return m_status == Offline; }
5007 {
return lookup(m_status,s_statusName); }
5014 {
return m_text ? m_text.c_str() : statusDisplayText(m_status); }
5029 {
return m_caps.changeFlagCheck(CapAudio,ok); }
5037 {
return m_caps.changeFlagCheck(CapFileTransfer,ok); }
5045 if (m_priority == prio)
5057 if (m_status == stat)
5082 {
return lookup(status,s_statusName,defVal); }
5141 inline explicit MucRoomMember(
const char*
id,
const char* nick,
const char* uri = 0)
5143 m_uri(uri), m_affiliation(AffNone), m_role(RoleNone)
5185 const char* nick = 0);
5192 {
return *m_resource; }
5200 {
return m_resource == item; }
5208 {
return m_resource->toString() == item; }
5215 return m_resource->online() &&
5216 m_resource->m_role > MucRoomMember::RoleNone;
5224 {
return available() && m_resource->m_role >= MucRoomMember::Visitor; }
5231 {
return available(); }
5238 {
return available() && m_resource->m_role == MucRoomMember::Moderator; }
5245 {
return available(); }
5279 Message* buildJoin(
bool join,
bool history =
true,
unsigned int sNewer = 0);
5294 {
return (!ref || m_resource->ref()) ? m_resource : 0; }
5323 bool hasChat(
const String&
id);
5330 virtual void flashChat(
const String&
id,
bool on =
true);
5338 virtual void getChatInput(
const String&
id,
String& text,
const String& name =
"message");
5347 const String& name =
"message");
5356 virtual void getChatHistory(
const String&
id,
String& text,
bool richText =
false,
5357 const String& name =
"history");
5366 virtual void setChatHistory(
const String&
id,
const String& text,
bool richText =
false,
5367 const String& name =
"history");
5377 const String& name =
"history");
5386 virtual void setChatProperty(
const String&
id,
const String& name,
const String& prop,
5396 virtual bool showChat(
const String&
id,
bool visible,
bool active =
false);
5404 virtual void createChatWindow(
const String&
id,
bool force =
false,
const char* name = 0);
5411 virtual void updateChatWindow(
const String&
id,
const NamedList& params);
5417 virtual bool isChatActive(
const String&
id);
5455 virtual bool removeResource(
const String& nick,
bool delChat =
false);
5464 virtual void destroyed();
5467 unsigned int m_index;
5491 : m_id(id), m_logic(0), m_name(name), m_startTime(start)
5492 { setLogic(logic,owner); }
5503 virtual const String& toString()
const;
5510 void setLogic(
ClientLogic* logic = 0,
bool owner =
true);
5521 virtual unsigned int update(
unsigned int secNow,
const String* table = 0,
5522 Window* wnd = 0,
Window* skip = 0,
bool force =
false);
5531 virtual unsigned int buildTimeParam(
NamedList& dest,
unsigned int secNow,
5532 bool force =
false);
5541 virtual unsigned int buildTimeString(
String& dest,
unsigned int secNow,
5542 bool force =
false);
5553 static unsigned int buildTimeParam(
NamedList& dest,
const char* param,
unsigned int secStart,
5554 unsigned int secNow,
bool force =
false);
5564 static unsigned int buildTimeString(
String& dest,
unsigned int secStart,
unsigned int secNow,
5565 bool force =
false);
5571 virtual void destroyed();
5576 unsigned int m_startTime;
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)
5619 {
return m_native; }
5626 {
return m_started; }
5633 {
return m_device; }
5640 {
Lock lock(s_soundsMutex); m_device = dev; }
5655 inline void file(
const char* filename,
bool stereo)
5656 {
Lock lock(s_soundsMutex); m_file = filename; m_stereo = stereo; }
5664 { m_repeat = count; }
5671 {
return m_stereo; }
5678 bool start(
bool force =
true);
5690 void setChannel(
const String& chan,
bool ok);
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);
5718 static bool started(
const String& name);
5726 static bool start(
const String& name,
bool force =
true);
5732 static void stop(
const String& name);
5759 virtual bool doStart();
5760 virtual void doStop();
5765 unsigned int m_repeat;
5843 { copyChildren(other.m_children); }
5850 {
return m_children; }
5857 {
return m_updated; }
5870 bool treeUpdated()
const;
5892 void copyChildren(
const ObjList& list);
5898 void addChildren(
ObjList& list);
5953 m_params.copyParams(*params);
5969 {
return m_params; }
5976 {
return m_params; }
virtual const String & toString() const
Definition: yatecbase.h:4985
bool oneThread() const
Definition: yatecbase.h:1295
virtual bool loginAccount(const NamedList &account, bool login)
Definition: yatecbase.h:2852
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 setClientParam(const String ¶m, const String &value, bool save, bool update)
Definition: yatecbase.h:2721
void addSlave(const String &sid)
Definition: yatecbase.h:2217
Affiliation
Definition: yatecbase.h:5115
bool hasPresence() const
Definition: yatecbase.h:3962
const String & transferId() const
Definition: yatecbase.h:2271
ClientFile(const char *name, const NamedList *params=0)
Definition: yatecbase.h:5950
static const String & lookupName(const ObjList &list, int val, const String &defVal=String::empty())
Definition: yatecbase.h:231
Definition: yateclass.h:949
virtual bool validateCall(NamedList ¶ms, Window *wnd=0)
Definition: yatecbase.h:2748
A regexp matching class.
Definition: yateclass.h:2902
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
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
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
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
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
const String & partyName() const
Definition: yatecbase.h:2257
static Mutex s_soundsMutex
Definition: yatecbase.h:5750
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 ¶ms)
Definition: yatecbase.h:1582
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
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 createSound(const char *name, const char *file, const char *device=0)
Definition: yatecbase.h:1702
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 bool insertResource(ClientResource *res)
Definition: yatecbase.h:5446
virtual void engineStart(Message &msg)
Definition: yatecbase.h:3100
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
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
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 ¶ms, 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 ¶ms)
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
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
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)
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
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 acceptAccount(NamedList *params, Window *wnd=0)
Definition: yatecbase.h:2824
A Channel driver module.
Definition: yatephone.h:2171
virtual bool delContact(const String &contact, Window *wnd=0)
Definition: yatecbase.h:2891
virtual bool callIncoming(Message &msg, const String &dest)
Definition: yatecbase.h:2739
constant YATOM(const char *string)
virtual void loadedWindows()
Definition: yatecbase.h:3494
void setClientData(RefObject *obj=0)
Definition: yatecbase.h:2286
ClientFile(const ClientFile &other)
Definition: yatecbase.h:5960
A named string class.
Definition: yateclass.h:3111
virtual bool select(Window *wnd, const String &name, const NamedList &items)
Definition: yatecbase.h:2710
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
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
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 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
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
A C-style string handling class.
Definition: yateclass.h:1832
static const String & cdrRemoteParty(const NamedList ¶ms, bool outgoing)
Definition: yatecbase.h:3151
String m_password
Definition: yatecbase.h:5460
A 32 bit length list of flags.
Definition: yatecbase.h:64
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)
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
static Message * buildMessage(const char *msg, const String &account, const char *oper=0)
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()
bool visible() const
Definition: yatecbase.h:679
const String & activeId() const
Definition: yatecbase.h:2520
int find(char what, unsigned int offs=0) const
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 handleResourceNotify(Message &msg, bool &stopLogic)
Definition: yatecbase.h:3054
virtual bool callLogUpdate(const NamedList ¶ms, 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
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
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