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
d7b25cca
Commit
d7b25cca
authored
Oct 26, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for chat rename
parent
83972316
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
interface.c
interface.c
+14
-0
queries.c
queries.c
+32
-0
queries.h
queries.h
+1
-0
No files found.
interface.c
View file @
d7b25cca
...
@@ -67,6 +67,7 @@ char *commands[] = {
...
@@ -67,6 +67,7 @@ char *commands[] = {
"chat_info"
,
"chat_info"
,
"user_info"
,
"user_info"
,
"fwd"
,
"fwd"
,
"rename_chat"
,
"show_license"
,
"show_license"
,
0
};
0
};
...
@@ -83,6 +84,7 @@ int commands_flags[] = {
...
@@ -83,6 +84,7 @@ int commands_flags[] = {
074
,
074
,
071
,
071
,
072
,
072
,
074
,
07
,
07
,
};
};
...
@@ -277,6 +279,18 @@ void interpreter (char *line UU) {
...
@@ -277,6 +279,18 @@ void interpreter (char *line UU) {
if
(
*
q
&&
index
<
user_num
+
chat_num
)
{
if
(
*
q
&&
index
<
user_num
+
chat_num
)
{
do_send_message
(
Peers
[
index
],
q
,
strlen
(
q
));
do_send_message
(
Peers
[
index
],
q
,
strlen
(
q
));
}
}
}
else
if
(
!
memcmp
(
line
,
"rename_chat"
,
11
))
{
char
*
q
=
line
+
11
;
int
len
;
char
*
text
=
get_token
(
&
q
,
&
len
);
int
index
=
0
;
while
(
index
<
user_num
+
chat_num
&&
(
!
Peers
[
index
]
->
print_name
||
strncmp
(
Peers
[
index
]
->
print_name
,
text
,
len
)
||
Peers
[
index
]
->
id
>=
0
))
{
index
++
;
}
while
(
*
q
&&
(
*
q
==
' '
||
*
q
==
'\t'
))
{
q
++
;
}
if
(
*
q
&&
index
<
user_num
+
chat_num
)
{
do_rename_chat
(
Peers
[
index
],
q
);
}
}
else
if
(
!
memcmp
(
line
,
"send_photo"
,
10
))
{
}
else
if
(
!
memcmp
(
line
,
"send_photo"
,
10
))
{
char
*
q
=
line
+
10
;
char
*
q
=
line
+
10
;
int
len
;
int
len
;
...
...
queries.c
View file @
d7b25cca
...
@@ -923,6 +923,38 @@ void do_forward_message (union user_chat *U, int n) {
...
@@ -923,6 +923,38 @@ void do_forward_message (union user_chat *U, int n) {
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
fwd_msg_methods
,
0
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
fwd_msg_methods
,
0
);
}
}
int
rename_chat_on_answer
(
struct
query
*
q
UU
)
{
assert
(
fetch_int
()
==
(
int
)
CODE_messages_stated_message
);
struct
message
*
M
=
fetch_alloc_message
();
assert
(
fetch_int
()
==
CODE_vector
);
int
n
,
i
;
n
=
fetch_int
();
for
(
i
=
0
;
i
<
n
;
i
++
)
{
fetch_alloc_chat
();
}
assert
(
fetch_int
()
==
CODE_vector
);
n
=
fetch_int
();
for
(
i
=
0
;
i
<
n
;
i
++
)
{
fetch_alloc_user
();
}
fetch_int
();
// pts
fetch_int
();
// seq
print_message
(
M
);
return
0
;
}
struct
query_methods
rename_chat_methods
=
{
.
on_answer
=
rename_chat_on_answer
};
void
do_rename_chat
(
union
user_chat
*
U
,
char
*
name
)
{
clear_packet
();
out_int
(
CODE_messages_edit_chat_title
);
out_int
(
-
U
->
id
);
out_string
(
name
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
rename_chat_methods
,
0
);
}
int
chat_info_on_answer
(
struct
query
*
q
UU
)
{
int
chat_info_on_answer
(
struct
query
*
q
UU
)
{
struct
chat
*
C
=
fetch_alloc_chat_full
();
struct
chat
*
C
=
fetch_alloc_chat_full
();
union
user_chat
*
U
=
(
void
*
)
C
;
union
user_chat
*
U
=
(
void
*
)
C
;
...
...
queries.h
View file @
d7b25cca
...
@@ -77,5 +77,6 @@ void do_get_chat_info (union user_chat *chat);
...
@@ -77,5 +77,6 @@ void do_get_chat_info (union user_chat *chat);
void
do_get_user_list_info_silent
(
int
num
,
int
*
list
);
void
do_get_user_list_info_silent
(
int
num
,
int
*
list
);
void
do_get_user_info
(
union
user_chat
*
user
);
void
do_get_user_info
(
union
user_chat
*
user
);
void
do_forward_message
(
union
user_chat
*
U
,
int
n
);
void
do_forward_message
(
union
user_chat
*
U
,
int
n
);
void
do_rename_chat
(
union
user_chat
*
U
,
char
*
name
);
#endif
#endif
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