Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
e7a1ac34
Commit
e7a1ac34
authored
19 years ago
by
jpbl
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
a3133d0a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gui/official/requesterimpl.cpp
+64
-2
64 additions, 2 deletions
src/gui/official/requesterimpl.cpp
src/gui/official/requesterimpl.h
+7
-1
7 additions, 1 deletion
src/gui/official/requesterimpl.h
with
71 additions
and
3 deletions
src/gui/official/requesterimpl.cpp
+
64
−
2
View file @
e7a1ac34
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include
<stdexcept>
#include
<stdexcept>
#include
"requesterimpl.h"
#include
"requesterimpl.h"
#include
"sessionio.h"
RequesterImpl
::
RequesterImpl
()
RequesterImpl
::
RequesterImpl
()
:
mCallIdCount
(
0
)
:
mCallIdCount
(
0
)
...
@@ -45,7 +46,7 @@ RequesterImpl::sendCallCommand(const std::string &sessionId,
...
@@ -45,7 +46,7 @@ RequesterImpl::sendCallCommand(const std::string &sessionId,
const
std
::
string
&
command
)
const
std
::
string
&
command
)
{
{
// We retreive the internal of a session.
// We retreive the internal of a session.
Session
Sender
*
session
=
getSession
Sender
(
sessionId
);
Session
IO
*
session
=
getSession
IO
(
sessionId
);
// We ask the factory to create the request.
// We ask the factory to create the request.
Request
*
request
=
mCallRequestFactory
.
create
(
command
,
sequenceId
,
callId
)
Request
*
request
=
mCallRequestFactory
.
create
(
command
,
sequenceId
,
callId
)
...
@@ -58,7 +59,68 @@ RequesterImpl::sendCallCommand(const std::string &sessionId,
...
@@ -58,7 +59,68 @@ RequesterImpl::sendCallCommand(const std::string &sessionId,
}
}
void
void
RequesterImpl
::
receiveCallCommand
RequesterImpl
::
registerRequest
(
const
std
::
string
&
sessionId
,
const
std
::
string
&
sequenceId
,
Request
*
request
)
{
if
(
mRequests
.
find
(
sequenceId
)
!=
mRequests
.
end
())
{
throw
std
::
logic_error
(
"Registering an already know sequence ID"
);
}
mRequests
.
insert
(
std
::
make_pair
(
sequenceId
,
request
));
}
void
RequesterImpl
::
receiveAnswer
(
const
std
::
string
&
answer
)
{
std
::
string
code
;
std
::
string
seq
;
std
::
string
message
;
std
::
istream
s
(
answer
);
s
>>
code
>>
seq
;
getline
(
s
,
message
);
receiveAnswer
(
code
,
seq
,
message
);
}
int
RequesterImpl
::
getCodeCategory
(
const
std
::
string
&
code
)
{
int
c
;
std
::
istream
s
(
code
);
s
>>
c
;
return
c
/
100
;
}
void
RequesterImpl
::
receiveAnswer
(
const
std
::
string
&
code
,
const
std
::
string
&
sequence
,
const
std
::
string
&
message
)
{
c
=
getCodeCategory
(
code
);
std
::
map
<
std
::
string
,
Request
*
>::
iterator
pos
;
pos
=
mRequests
.
find
(
sequence
);
if
(
pos
==
mRequests
.
end
())
{
std
::
cerr
<<
"We received an answer with an unknown sequence"
<<
std
::
endl
;
return
;
}
if
(
c
<=
1
)
{
//Other answers will come for this request.
(
*
pos
)
->
onEntry
(
code
,
message
);
}
else
{
//This is the final answer of this request.
if
(
c
==
2
)
{
(
*
pos
)
->
onSuccess
(
code
,
message
);
}
else
{
(
*
pos
)
->
onError
(
code
,
message
);
}
delete
(
*
pos
);
mRequests
.
erase
(
pos
);
}
}
std
::
string
std
::
string
RequesterImpl
::
generateCallId
()
RequesterImpl
::
generateCallId
()
...
...
This diff is collapsed.
Click to expand it.
src/gui/official/requesterimpl.h
+
7
−
1
View file @
e7a1ac34
...
@@ -41,7 +41,7 @@ class RequesterImpl
...
@@ -41,7 +41,7 @@ class RequesterImpl
const
std
::
string
&
callId
,
const
std
::
string
&
callId
,
char
*
command
);
char
*
command
);
static
int
getCodeCategory
(
const
std
::
string
&
code
);
private:
private:
/**
/**
...
@@ -64,9 +64,15 @@ class RequesterImpl
...
@@ -64,9 +64,15 @@ class RequesterImpl
*/
*/
std
::
string
generateSequenceId
();
std
::
string
generateSequenceId
();
/**
* Return the SessionIO instance related to
* the session ID.
*/
SessionIO
*
getSessionIO
(
const
std
::
string
&
sessionId
);
private:
private:
std
::
map
<
std
::
string
,
SessionIO
*
>
mSessions
;
std
::
map
<
std
::
string
,
SessionIO
*
>
mSessions
;
std
::
map
<
std
::
string
,
Request
*
>
mRequests
;
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment