Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
9361621c
Commit
9361621c
authored
Nov 07, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add suggested contacts query
parent
a9062675
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
interface.c
interface.c
+4
-0
queries.c
queries.c
+42
-0
queries.h
queries.h
+1
-0
No files found.
interface.c
View file @
9361621c
...
...
@@ -254,6 +254,7 @@ char *commands[] = {
"mark_read"
,
"visualize_key"
,
"create_secret_chat"
,
"suggested_contacts"
,
0
};
int
commands_flags
[]
=
{
...
...
@@ -283,6 +284,7 @@ int commands_flags[] = {
072
,
075
,
071
,
07
,
};
int
get_complete_mode
(
void
)
{
...
...
@@ -752,6 +754,8 @@ void interpreter (char *line UU) {
}
else
if
(
IS_WORD
(
"create_secret_chat"
))
{
GET_PEER
;
do_create_secret_chat
(
id
);
}
else
if
(
IS_WORD
(
"suggested_contacts"
))
{
do_get_suggested
();
}
#undef IS_WORD
#undef RET
...
...
queries.c
View file @
9361621c
...
...
@@ -2388,6 +2388,48 @@ void do_visualize_key (peer_id_t id) {
}
/* }}} */
/* {{{ Get suggested */
int
get_suggested_on_answer
(
struct
query
*
q
UU
)
{
assert
(
fetch_int
()
==
CODE_contacts_suggested
);
assert
(
fetch_int
()
==
CODE_vector
);
int
n
=
fetch_int
();
logprintf
(
"n = %d
\n
"
,
n
);
assert
(
n
<=
200
);
int
l
[
400
];
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
assert
(
fetch_int
()
==
CODE_contact_suggested
);
l
[
2
*
i
]
=
fetch_int
();
l
[
2
*
i
+
1
]
=
fetch_int
();
}
assert
(
fetch_int
()
==
CODE_vector
);
int
m
=
fetch_int
();
assert
(
n
==
m
);
print_start
();
push_color
(
COLOR_YELLOW
);
for
(
i
=
0
;
i
<
m
;
i
++
)
{
peer_t
*
U
=
(
void
*
)
fetch_alloc_user
();
assert
(
get_peer_id
(
U
->
id
)
==
l
[
2
*
i
]);
print_user_name
(
U
->
id
,
U
);
printf
(
"phone %s: %d mutual friends
\n
"
,
U
->
user
.
phone
,
l
[
2
*
i
+
1
]);
}
pop_color
();
print_end
();
return
0
;
}
struct
query_methods
get_suggested_methods
=
{
.
on_answer
=
get_suggested_on_answer
};
void
do_get_suggested
(
void
)
{
clear_packet
();
out_int
(
CODE_contacts_get_suggested
);
out_int
(
100
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
get_suggested_methods
,
0
);
}
/* }}} */
/* {{{ Create secret chat */
char
*
create_print_name
(
peer_id_t
id
,
const
char
*
a1
,
const
char
*
a2
,
const
char
*
a3
,
const
char
*
a4
);
...
...
queries.h
View file @
9361621c
...
...
@@ -83,6 +83,7 @@ void do_rename_chat (peer_id_t id, char *name);
void
do_load_encr_video
(
struct
encr_video
*
V
,
int
next
);
void
do_create_encr_chat_request
(
struct
secret_chat
*
E
);
void
do_create_secret_chat
(
peer_id_t
id
);
void
do_get_suggested
(
void
);
struct
photo
;
struct
video
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment