Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
f9603315
Commit
f9603315
authored
Jul 11, 2005
by
llea
Browse files
Add/check function return
Remove unused mute function
parent
22ec84c9
Changes
11
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
f9603315
Laurielle LEA (11 July 2005) version 0.4
- Check functions return.
- Remove unused mute functions
Laurielle LEA (8 July 2005) version 0.4
- Stop program when error opening skin file
- Divide toggle() of qtguimainwindow.cpp in small functions
...
...
sflphone.spec.in
View file @
f9603315
%define name sflphone
%define version 0.
1
%define release
1
%define version 0.
4
%define release
4
%define prefix /usr
Autoreq: 0
...
...
@@ -12,7 +12,7 @@ Copyright: GPL
Group: Networking/Utilities
URL: http://www.sflphone.org
Packager: Cyrille Béraud <cyrille.beraud@savoirfairelinux.com>
Source: http://www.sflphone.org/sflphone-0.
1
.tar.gz
Source: http://www.sflphone.org/sflphone-0.
4
.tar.gz
BuildRoot: /tmp/sflphone-%{version}-%{release}
%description
...
...
src/call.cpp
View file @
f9603315
...
...
@@ -306,18 +306,6 @@ Call::transfer (const string& to)
return
i
;
}
int
Call
::
muteOn
(
void
)
{
return
1
;
}
int
Call
::
muteOff
(
void
)
{
return
1
;
}
int
Call
::
refuse
(
void
)
{
...
...
src/call.h
View file @
f9603315
...
...
@@ -106,8 +106,6 @@ public:
int
onHold
(
void
);
int
offHold
(
void
);
int
transfer
(
const
string
&
to
);
int
muteOn
(
void
);
int
muteOff
(
void
);
int
refuse
(
void
);
private:
...
...
src/gui/guiframework.cpp
View file @
f9603315
...
...
@@ -39,7 +39,7 @@ GuiFramework::outgoingCall (const string& to)
int
GuiFramework
::
hangupCall
(
short
id
)
{
if
(
_manager
->
hangupCall
(
id
))
{
if
(
_manager
->
hangupCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -49,7 +49,7 @@ GuiFramework::hangupCall (short id)
int
GuiFramework
::
cancelCall
(
short
id
)
{
if
(
_manager
->
cancelCall
(
id
))
{
if
(
_manager
->
cancelCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -59,7 +59,7 @@ GuiFramework::cancelCall (short id)
int
GuiFramework
::
answerCall
(
short
id
)
{
if
(
_manager
->
answerCall
(
id
))
{
if
(
_manager
->
answerCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -69,7 +69,7 @@ GuiFramework::answerCall (short id)
int
GuiFramework
::
onHoldCall
(
short
id
)
{
if
(
_manager
->
onHoldCall
(
id
))
{
if
(
_manager
->
onHoldCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -79,7 +79,7 @@ GuiFramework::onHoldCall (short id)
int
GuiFramework
::
offHoldCall
(
short
id
)
{
if
(
_manager
->
offHoldCall
(
id
))
{
if
(
_manager
->
offHoldCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -89,37 +89,29 @@ GuiFramework::offHoldCall (short id)
int
GuiFramework
::
transferCall
(
short
id
,
const
string
&
to
)
{
if
(
_manager
->
transferCall
(
id
,
to
))
{
if
(
_manager
->
transferCall
(
id
,
to
)
==
1
)
{
return
1
;
}
else
{
return
0
;
}
}
int
void
GuiFramework
::
muteOn
(
short
id
)
{
if
(
_manager
->
muteOn
(
id
))
{
return
1
;
}
else
{
return
0
;
}
_manager
->
muteOn
(
id
);
}
int
void
GuiFramework
::
muteOff
(
short
id
)
{
if
(
_manager
->
muteOff
(
id
))
{
return
1
;
}
else
{
return
0
;
}
_manager
->
muteOff
(
id
);
}
int
GuiFramework
::
refuseCall
(
short
id
)
{
if
(
_manager
->
refuseCall
(
id
))
{
if
(
_manager
->
refuseCall
(
id
)
==
0
)
{
return
1
;
}
else
{
return
0
;
...
...
src/gui/guiframework.h
View file @
f9603315
...
...
@@ -34,7 +34,7 @@ public:
/* Parent class to child class */
virtual
int
incomingCall
(
short
id
)
=
0
;
virtual
int
peerAnsweredCall
(
short
id
)
=
0
;
virtual
void
peerAnsweredCall
(
short
id
)
=
0
;
virtual
int
peerRingingCall
(
short
id
)
=
0
;
virtual
int
peerHungupCall
(
short
id
)
=
0
;
virtual
void
displayTextMessage
(
short
id
,
const
string
&
message
)
=
0
;
...
...
@@ -55,8 +55,8 @@ public:
int
onHoldCall
(
short
id
);
int
offHoldCall
(
short
id
);
int
transferCall
(
short
id
,
const
string
&
to
);
int
muteOn
(
short
id
);
int
muteOff
(
short
id
);
void
muteOn
(
short
id
);
void
muteOff
(
short
id
);
int
refuseCall
(
short
id
);
int
saveConfig
(
void
);
...
...
src/gui/qt/qtGUImainwindow.cpp
View file @
f9603315
...
...
@@ -650,18 +650,11 @@ QtGUIMainWindow::callIsRinging(int id, int line, int busyLine)
void
QtGUIMainWindow
::
callIsProgressing
(
int
id
,
int
line
,
int
busyLine
)
{
changeLineStatePixmap
(
line
,
BUSY
);
putOnHoldBusyLine
(
busyLine
);
displayContext
(
id
);
if
(
getChooseLine
())
{
// If a free line is off-hook, set this line to free state
setChooseLine
(
false
);
changeLineStatePixmap
(
getChosenLine
(),
FREE
);
dialtone
(
false
);
}
// Same function of callIsRinging
callIsRinging
(
id
,
line
,
busyLine
);
}
void
int
QtGUIMainWindow
::
callIsBusy
(
Call
*
call
,
int
id
,
int
line
,
int
busyLine
)
{
if
(
call
->
isAnswered
()
and
getPrevLine
()
!=
line
)
{
...
...
@@ -681,11 +674,15 @@ QtGUIMainWindow::callIsBusy (Call* call, int id, int line, int busyLine)
_debug
(
"CASE 4 Put Call %d on-hold
\n
"
,
id
);
changeLineStatePixmap
(
line
,
ONHOLD
);
displayStatus
(
ONHOLD_STATUS
);
qt_onHoldCall
(
id
);
if
(
qt_onHoldCall
(
id
)
!=
1
)
{
_callmanager
->
displayErrorText
(
"On-hold call failed !
\n
"
);
return
-
1
;
}
}
return
1
;
}
void
int
QtGUIMainWindow
::
callIsOnHold
(
int
id
,
int
line
,
int
busyLine
)
{
changeLineStatePixmap
(
line
,
BUSY
);
...
...
@@ -697,16 +694,24 @@ QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine)
dialtone
(
false
);
}
_lcd
->
setInFunction
(
true
);
qt_offHoldCall
(
id
);
if
(
qt_offHoldCall
(
id
)
!=
1
)
{
_callmanager
->
displayErrorText
(
"Off-hold call failed !
\n
"
);
return
-
1
;
}
displayContext
(
id
);
return
1
;
}
void
int
QtGUIMainWindow
::
callIsIncoming
(
int
id
,
int
line
,
int
busyLine
)
{
changeLineStatePixmap
(
line
,
BUSY
);
putOnHoldBusyLine
(
busyLine
);
qt_answerCall
(
id
);
if
(
qt_answerCall
(
id
)
!=
1
)
{
_callmanager
->
displayErrorText
(
"Answered call failed !
\n
"
);
return
-
1
;
}
return
1
;
}
void
...
...
@@ -834,7 +839,7 @@ QtGUIMainWindow::incomingCall (short id)
return
i
;
}
int
void
QtGUIMainWindow
::
peerAnsweredCall
(
short
id
)
{
dialtone
(
false
);
...
...
@@ -843,8 +848,6 @@ QtGUIMainWindow::peerAnsweredCall (short id)
startCallTimer
(
id
);
_callmanager
->
displayStatus
(
CONNECTED_STATUS
);
setChooseLine
(
false
);
return
1
;
}
int
...
...
@@ -970,6 +973,8 @@ QtGUIMainWindow::qt_outgoingCall (void)
displayStatus
(
TRYING_STATUS
);
_callmanager
->
getCall
(
id
)
->
setCallerIdNumber
(
to
);
changeLineStatePixmap
(
line
,
BUSY
);
}
else
{
_callmanager
->
displayErrorText
(
"Outgoing call failed !
\n
"
);
}
return
line
;
...
...
@@ -1041,8 +1046,7 @@ QtGUIMainWindow::qt_transferCall (short id)
void
QtGUIMainWindow
::
qt_muteOn
(
short
id
)
{
int
i
;
i
=
muteOn
(
id
);
muteOn
(
id
);
getPhoneLine
(
id
)
->
setStatus
(
QString
(
getCall
(
id
)
->
getStatus
()));
displayStatus
(
MUTE_ON_STATUS
);
}
...
...
@@ -1050,8 +1054,7 @@ QtGUIMainWindow::qt_muteOn (short id)
void
QtGUIMainWindow
::
qt_muteOff
(
short
id
)
{
int
i
;
i
=
muteOff
(
id
);
muteOff
(
id
);
getPhoneLine
(
id
)
->
setStatus
(
QString
(
getCall
(
id
)
->
getStatus
()));
displayStatus
(
CONNECTED_STATUS
);
}
...
...
@@ -1087,6 +1090,7 @@ QtGUIMainWindow::toggleLine (int line)
{
int
id
;
int
busyLine
;
int
ret
=
1
;
Call
*
call
;
...
...
@@ -1113,18 +1117,18 @@ QtGUIMainWindow::toggleLine (int line)
_debug
(
"CASE 2: Call %d is progressing
\n
"
,
id
);
callIsProgressing
(
id
,
line
,
busyLine
);
}
else
if
(
call
->
isBusy
())
{
callIsBusy
(
call
,
id
,
line
,
busyLine
);
ret
=
callIsBusy
(
call
,
id
,
line
,
busyLine
);
}
else
if
(
call
->
isOnHold
())
{
// If call is on hold, put this call on busy state
_debug
(
"CASE 5: Put Call %d off-hold
\n
"
,
id
);
callIsOnHold
(
id
,
line
,
busyLine
);
ret
=
callIsOnHold
(
id
,
line
,
busyLine
);
}
else
if
(
call
->
isIncomingType
())
{
// If incoming call occurs
_debug
(
"CASE 6: Answer call %d
\n
"
,
id
);
callIsIncoming
(
id
,
line
,
busyLine
);
ret
=
callIsIncoming
(
id
,
line
,
busyLine
);
}
else
{
_debug
(
"Others cases to handle
\n
"
);
ret
urn
-
1
;
ret
=
-
1
;
}
setPrevLine
(
line
);
}
else
{
...
...
@@ -1132,7 +1136,7 @@ QtGUIMainWindow::toggleLine (int line)
_debug
(
"CASE 7: New line off-hook
\n
"
);
clickOnFreeLine
(
line
,
busyLine
);
}
return
1
;
return
ret
;
}
/**
...
...
@@ -1145,24 +1149,32 @@ QtGUIMainWindow::dial (void)
short
i
;
int
line
=
-
1
;
try
{
if
((
i
=
isThereI
ncoming
C
all
())
>
0
)
{
// If new incoming call
line
=
id2line
(
i
);
if
((
i
=
isThereIncomingCall
())
>
0
)
{
// If new i
ncoming
c
all
line
=
id2line
(
i
);
if
(
line
!
=
-
1
)
{
_TabIncomingCalls
[
line
]
=
-
1
;
toggleLine
(
line
);
}
else
if
(
getTransfer
()){
// If call transfer
qt_transferCall
(
line2id
(
getCurrentLine
()));
//setPrevLine(line);
}
else
{
// If new outgoing call
if
(
getCurrentLine
()
<
0
or
getChooseLine
())
{
line
=
qt_outgoingCall
();
}
}
}
catch
(
const
exception
&
e
)
{
_callmanager
->
displayErrorText
(
e
.
what
());
}
return
;
}
}
else
if
(
getTransfer
()){
// If call transfer
if
(
qt_transferCall
(
line2id
(
getCurrentLine
())
!=
1
))
{
_callmanager
->
displayErrorText
(
"Transfer failed !
\n
"
);
}
}
else
{
// If new outgoing call
if
(
getCurrentLine
()
<
0
or
getChooseLine
())
{
line
=
qt_outgoingCall
();
if
(
line
==
-
1
)
{
return
;
}
else
{
setPrevLine
(
line
);
}
}
}
}
/**
...
...
@@ -1175,41 +1187,49 @@ QtGUIMainWindow::hangupLine (void)
int
line
=
getCurrentLine
();
int
id
=
phLines
[
line
]
->
getCallId
();
try
{
if
(
_callmanager
->
getbC
ongestion
())
{
// If congestion tone
if
(
_callmanager
->
getbCongestion
())
{
// If c
ongestion
tone
if
(
qt_hangupCall
(
id
))
{
changeLineStatePixmap
(
line
,
FREE
);
_lcd
->
clear
(
QString
(
ENTER_NUMBER_STATUS
));
qt_hangupCall
(
id
);
_callmanager
->
congestion
(
false
);
phLines
[
line
]
->
setCallId
(
0
);
}
else
if
(
line
>=
0
and
id
>
0
and
getCall
(
id
)
->
isProgressing
())
{
// If I want to cancel a call before ringing.
qt_cancelCall
(
id
);
}
else
{
_callmanager
->
displayErrorText
(
"Hangup call failed !
\n
"
);
}
}
else
if
(
line
>=
0
and
id
>
0
and
getCall
(
id
)
->
isProgressing
())
{
// If I want to cancel a call before ringing.
if
(
qt_cancelCall
(
id
))
{
changeLineStatePixmap
(
line
,
FREE
);
phLines
[
line
]
->
setCallId
(
0
);
setChooseLine
(
false
);
}
else
if
(
line
>=
0
and
id
>
0
)
{
// If hangup current line normally
_debug
(
"Hangup line %d
\n
"
,
line
);
qt_hangupCall
(
id
);
}
else
{
_callmanager
->
displayErrorText
(
"Cancelled call failed !
\n
"
);
}
}
else
if
(
line
>=
0
and
id
>
0
)
{
// If hangup current line normally
_debug
(
"Hangup line %d
\n
"
,
line
);
if
(
qt_hangupCall
(
id
))
{
changeLineStatePixmap
(
line
,
FREE
);
phLines
[
line
]
->
setCallId
(
0
);
setChooseLine
(
false
);
}
else
if
((
i
=
isThereIncomingCall
())
>
0
){
// To refuse new incoming call
_debug
(
"Refuse call %d
\n
"
,
id
);
qt_refuseCall
(
i
);
}
else
{
_callmanager
->
displayErrorText
(
"Hangup call failed !
\n
"
);
}
}
else
if
((
i
=
isThereIncomingCall
())
>
0
){
// To refuse new incoming call
_debug
(
"Refuse call %d
\n
"
,
id
);
if
(
qt_refuseCall
(
i
))
{
changeLineStatePixmap
(
id2line
(
i
),
FREE
);
}
else
if
(
line
>=
0
)
{
_debug
(
"Just load free pixmap for the line %d
\n
"
,
line
);
changeLineStatePixmap
(
line
,
FREE
);
dialtone
(
false
);
setChooseLine
(
false
);
setCurrentLine
(
-
1
);
}
else
{
_callmanager
->
displayErrorText
(
"Refused call failed !
\n
"
);
}
}
catch
(
const
exception
&
e
)
{
_callmanager
->
displayErrorText
(
e
.
what
());
}
else
if
(
line
>=
0
)
{
_debug
(
"Just load free pixmap for the line %d
\n
"
,
line
);
changeLineStatePixmap
(
line
,
FREE
);
dialtone
(
false
);
setChooseLine
(
false
);
setCurrentLine
(
-
1
);
}
}
...
...
@@ -1299,7 +1319,9 @@ void
QtGUIMainWindow
::
button_msg
(
void
)
{
stopTimerMessage
();
_lcd
->
appendText
(
get_config_fields_str
(
PREFERENCES
,
VOICEMAIL_NUM
));
qt_outgoingCall
();
if
(
qt_outgoingCall
()
==
-
1
)
{
return
;
}
}
// Allow to enter a phone number to transfer the current call.
...
...
src/gui/qt/qtGUImainwindow.h
View file @
f9603315
...
...
@@ -84,7 +84,7 @@ public:
// Reimplementation of virtual functions
virtual
int
incomingCall
(
short
id
);
virtual
int
peerAnsweredCall
(
short
id
);
virtual
void
peerAnsweredCall
(
short
id
);
virtual
int
peerRingingCall
(
short
id
);
virtual
int
peerHungupCall
(
short
id
);
virtual
void
displayTextMessage
(
short
id
,
const
string
&
message
);
...
...
@@ -366,13 +366,13 @@ private:
void
dialtone
(
bool
var
);
/*
* Functions
of
toggle function
* Functions
used in
toggle function
*/
void
callIsRinging
(
int
id
,
int
line
,
int
busyLine
);
void
callIsProgressing
(
int
id
,
int
line
,
int
busyLine
);
void
callIsBusy
(
Call
*
call
,
int
id
,
int
line
,
int
busyLine
);
void
callIsOnHold
(
int
id
,
int
line
,
int
busyLine
);
void
callIsIncoming
(
int
id
,
int
line
,
int
busyLine
);
int
callIsBusy
(
Call
*
call
,
int
id
,
int
line
,
int
busyLine
);
int
callIsOnHold
(
int
id
,
int
line
,
int
busyLine
);
int
callIsIncoming
(
int
id
,
int
line
,
int
busyLine
);
void
clickOnFreeLine
(
int
line
,
int
busyLine
);
};
...
...
src/manager.cpp
View file @
f9603315
...
...
@@ -269,6 +269,8 @@ Manager::outgoingCall (const string& to)
_debug
(
"Outgoing Call with identifiant %d
\n
"
,
id
);
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
0
;
call
->
setStatus
(
string
(
TRYING_STATUS
));
call
->
setState
(
Progressing
);
...
...
@@ -285,9 +287,10 @@ Manager::hangupCall (short id)
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
HUNGUP_STATUS
));
call
->
setState
(
Hungup
);
call
->
hangup
();
_mutex
.
enterMutex
();
_nCalls
-=
1
;
_mutex
.
leaveMutex
();
...
...
@@ -295,7 +298,7 @@ Manager::hangupCall (short id)
if
(
getbRingback
())
{
ringback
(
false
);
}
return
1
;
return
call
->
hangup
()
;
}
int
...
...
@@ -304,9 +307,10 @@ Manager::cancelCall (short id)
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
HUNGUP_STATUS
));
call
->
setState
(
Hungup
);
call
->
cancel
();
_mutex
.
enterMutex
();
_nCalls
-=
1
;
_mutex
.
leaveMutex
();
...
...
@@ -314,7 +318,7 @@ Manager::cancelCall (short id)
if
(
getbRingback
())
{
ringback
(
false
);
}
return
1
;
return
call
->
cancel
()
;
}
int
...
...
@@ -323,11 +327,12 @@ Manager::answerCall (short id)
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
CONNECTED_STATUS
));
call
->
setState
(
Answered
);
call
->
answer
();
ringtone
(
false
);
return
1
;
return
call
->
answer
()
;
}
int
...
...
@@ -335,10 +340,11 @@ Manager::onHoldCall (short id)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
ONHOLD_STATUS
));
call
->
setState
(
OnHold
);
call
->
onHold
();
return
1
;
return
call
->
onHold
();
}
int
...
...
@@ -346,10 +352,11 @@ Manager::offHoldCall (short id)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
CONNECTED_STATUS
));
call
->
setState
(
OffHold
);
call
->
offHold
();
return
1
;
return
call
->
offHold
();
}
int
...
...
@@ -357,32 +364,37 @@ Manager::transferCall (short id, const string& to)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
TRANSFER_STATUS
));
call
->
setState
(
Transfered
);
call
->
transfer
(
to
);
return
1
;
if
(
call
->
transfer
(
to
)
!=
0
)
{
return
-
1
;
}
else
{
return
1
;
}
}
int
void
Manager
::
muteOn
(
short
id
)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
;
call
->
setStatus
(
string
(
MUTE_ON_STATUS
));
call
->
setState
(
MuteOn
);
call
->
muteOn
();
return
1
;
}
int
void
Manager
::
muteOff
(
short
id
)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
;
call
->
setStatus
(
string
(
CONNECTED_STATUS
));
call
->
setState
(
MuteOff
);
call
->
muteOff
();
return
1
;
}
int
...
...
@@ -390,12 +402,13 @@ Manager::refuseCall (short id)
{
Call
*
call
;
call
=
getCall
(
id
);
if
(
call
==
NULL
)
return
-
1
;
call
->
setStatus
(
string
(
HUNGUP_STATUS
));
call
->
setState
(
Refused
);
call
->
refuse
();
ringtone
(
false
);
delete
call
;
return
1
;
return
call
->
refuse
()
;
}
int
...
...
@@ -476,17 +489,18 @@ Manager::incomingCall (short id)
{
Call
*
call
;