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
1af0fb84
Commit
1af0fb84
authored
Sep 10, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
del_contact query
parent
94c27ccc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
0 deletions
+48
-0
interface.c
interface.c
+4
-0
lua-tg.c
lua-tg.c
+5
-0
queries.c
queries.c
+38
-0
tgl.h
tgl.h
+1
-0
No files found.
interface.c
View file @
1af0fb84
...
@@ -379,6 +379,7 @@ struct command commands[] = {
...
@@ -379,6 +379,7 @@ struct command commands[] = {
{
"load_document_thumb"
,
{
ca_number
,
ca_none
}},
{
"load_document_thumb"
,
{
ca_number
,
ca_none
}},
{
"view_document_thumb"
,
{
ca_number
,
ca_none
}},
{
"view_document_thumb"
,
{
ca_number
,
ca_none
}},
{
"add_contact"
,
{
ca_string
,
ca_string
,
ca_string
,
ca_none
}},
{
"add_contact"
,
{
ca_string
,
ca_string
,
ca_string
,
ca_none
}},
{
"del_contact"
,
{
ca_user
,
ca_none
}},
{
"rename_contact"
,
{
ca_user
,
ca_string
,
ca_string
,
ca_none
}},
{
"rename_contact"
,
{
ca_user
,
ca_string
,
ca_string
,
ca_none
}},
{
"show_license"
,
{
ca_none
}},
{
"show_license"
,
{
ca_none
}},
{
"search"
,
{
ca_peer
,
ca_string_end
}},
{
"search"
,
{
ca_peer
,
ca_string_end
}},
...
@@ -1339,6 +1340,9 @@ void interpreter (char *line UU) {
...
@@ -1339,6 +1340,9 @@ void interpreter (char *line UU) {
RET
;
RET
;
}
}
tgl_do_add_contact
(
phone
,
phone_len
,
first_name
,
first_name_len
,
last_name
,
last_name_len
,
0
,
print_user_list_gw
,
0
);
tgl_do_add_contact
(
phone
,
phone_len
,
first_name
,
first_name_len
,
last_name
,
last_name_len
,
0
,
print_user_list_gw
,
0
);
}
else
if
(
IS_WORD
(
"del_contact"
))
{
GET_PEER_USER
;
tgl_do_del_contact
(
id
,
0
,
0
);
}
else
if
(
IS_WORD
(
"send_contact"
))
{
}
else
if
(
IS_WORD
(
"send_contact"
))
{
GET_PEER
;
GET_PEER
;
int
phone_len
,
first_name_len
,
last_name_len
;
int
phone_len
,
first_name_len
,
last_name_len
;
...
...
lua-tg.c
View file @
1af0fb84
...
@@ -474,6 +474,7 @@ enum lua_query_type {
...
@@ -474,6 +474,7 @@ enum lua_query_type {
lq_chat_add_user
,
lq_chat_add_user
,
lq_chat_del_user
,
lq_chat_del_user
,
lq_add_contact
,
lq_add_contact
,
lq_del_contact
,
lq_rename_contact
,
lq_rename_contact
,
lq_search
,
lq_search
,
lq_global_search
,
lq_global_search
,
...
@@ -968,6 +969,9 @@ void lua_do_all (void) {
...
@@ -968,6 +969,9 @@ void lua_do_all (void) {
free
(
s3
);
free
(
s3
);
p
+=
4
;
p
+=
4
;
break
;
break
;
case
lq_del_contact
:
tgl_do_del_contact
(((
tgl_peer_t
*
)
lua_ptr
[
p
+
1
])
->
id
,
lua_empty_cb
,
lua_ptr
[
p
]);
break
;
case
lq_rename_contact
:
case
lq_rename_contact
:
s1
=
lua_ptr
[
p
+
1
];
s1
=
lua_ptr
[
p
+
1
];
s2
=
lua_ptr
[
p
+
2
];
s2
=
lua_ptr
[
p
+
2
];
...
@@ -1108,6 +1112,7 @@ struct lua_function functions[] = {
...
@@ -1108,6 +1112,7 @@ struct lua_function functions[] = {
{
"chat_add_user"
,
lq_chat_add_user
,
{
lfp_chat
,
lfp_user
,
lfp_none
}},
{
"chat_add_user"
,
lq_chat_add_user
,
{
lfp_chat
,
lfp_user
,
lfp_none
}},
{
"chat_del_user"
,
lq_chat_del_user
,
{
lfp_chat
,
lfp_user
,
lfp_none
}},
{
"chat_del_user"
,
lq_chat_del_user
,
{
lfp_chat
,
lfp_user
,
lfp_none
}},
{
"add_contact"
,
lq_add_contact
,
{
lfp_string
,
lfp_string
,
lfp_string
,
lfp_none
}},
{
"add_contact"
,
lq_add_contact
,
{
lfp_string
,
lfp_string
,
lfp_string
,
lfp_none
}},
{
"del_contact"
,
lq_del_contact
,
{
lfp_user
,
lfp_none
}},
{
"rename_contact"
,
lq_rename_contact
,
{
lfp_string
,
lfp_string
,
lfp_string
,
lfp_none
}},
{
"rename_contact"
,
lq_rename_contact
,
{
lfp_string
,
lfp_string
,
lfp_string
,
lfp_none
}},
{
"msg_search"
,
lq_search
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"msg_search"
,
lq_search
,
{
lfp_peer
,
lfp_string
,
lfp_none
}},
{
"msg_global_search"
,
lq_global_search
,
{
lfp_string
,
lfp_none
}},
{
"msg_global_search"
,
lq_global_search
,
{
lfp_string
,
lfp_none
}},
...
...
queries.c
View file @
1af0fb84
...
@@ -2600,6 +2600,44 @@ void tgl_do_add_contact (const char *phone, int phone_len, const char *first_nam
...
@@ -2600,6 +2600,44 @@ void tgl_do_add_contact (const char *phone, int phone_len, const char *first_nam
}
}
/* }}} */
/* }}} */
/* {{{ Add contact */
static
int
del_contact_on_answer
(
struct
query
*
q
UU
)
{
assert
(
skip_type_contacts_link
(
TYPE_TO_PARAM
(
contacts_link
))
>=
0
);
if
(
q
->
callback
)
{
((
void
(
*
)(
void
*
,
int
))
q
->
callback
)
(
q
->
callback_extra
,
1
);
}
return
0
;
}
static
struct
query_methods
del_contact_methods
=
{
.
on_answer
=
del_contact_on_answer
,
.
type
=
TYPE_TO_PARAM
(
contacts_link
)
};
void
tgl_do_del_contact
(
tgl_peer_id_t
id
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
),
void
*
callback_extra
)
{
if
(
tgl_get_peer_type
(
id
)
!=
TGL_PEER_USER
)
{
if
(
callback
)
{
callback
(
callback_extra
,
0
);
}
return
;
}
clear_packet
();
out_int
(
CODE_contacts_delete_contact
);
tgl_peer_t
*
U
=
tgl_peer_get
(
id
);
if
(
U
&&
U
->
user
.
access_hash
)
{
out_int
(
CODE_input_user_foreign
);
out_int
(
tgl_get_peer_id
(
id
));
out_long
(
U
->
user
.
access_hash
);
}
else
{
out_int
(
CODE_input_user_contact
);
out_int
(
tgl_get_peer_id
(
id
));
}
tglq_send_query
(
tgl_state
.
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
del_contact_methods
,
0
,
callback
,
callback_extra
);
}
/* }}} */
/* {{{ Msg search */
/* {{{ Msg search */
static
int
msg_search_on_answer
(
struct
query
*
q
UU
)
{
static
int
msg_search_on_answer
(
struct
query
*
q
UU
)
{
return
get_history_on_answer
(
q
);
return
get_history_on_answer
(
q
);
...
...
tgl.h
View file @
1af0fb84
...
@@ -281,6 +281,7 @@ void tgl_do_export_card (void (*callback)(void *callback_extra, int success, int
...
@@ -281,6 +281,7 @@ void tgl_do_export_card (void (*callback)(void *callback_extra, int success, int
void
tgl_do_import_card
(
int
size
,
int
*
card
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_user
*
U
),
void
*
callback_extra
);
void
tgl_do_import_card
(
int
size
,
int
*
card
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_user
*
U
),
void
*
callback_extra
);
void
tgl_do_send_contact
(
tgl_peer_id_t
id
,
const
char
*
phone
,
int
phone_len
,
const
char
*
first_name
,
int
first_name_len
,
const
char
*
last_name
,
int
last_name_len
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_send_contact
(
tgl_peer_id_t
id
,
const
char
*
phone
,
int
phone_len
,
const
char
*
first_name
,
int
first_name_len
,
const
char
*
last_name
,
int
last_name_len
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_forward_media
(
tgl_peer_id_t
id
,
int
n
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_forward_media
(
tgl_peer_id_t
id
,
int
n
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_del_contact
(
tgl_peer_id_t
id
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
),
void
*
callback_extra
);
void
tgl_do_visualize_key
(
tgl_peer_id_t
id
,
unsigned
char
buf
[
16
]);
void
tgl_do_visualize_key
(
tgl_peer_id_t
id
,
unsigned
char
buf
[
16
]);
...
...
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