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
5f40cc4e
Commit
5f40cc4e
authored
Feb 25, 2014
by
vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #121 from vDorst/create_group_chat
Added command create_group_chat <user> <chat topic>.
parents
a5b6f93a
f0436e61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
0 deletions
+44
-0
README.md
README.md
+1
-0
interface.c
interface.c
+12
-0
queries.c
queries.c
+30
-0
queries.h
queries.h
+1
-0
No files found.
README.md
View file @
5f40cc4e
...
...
@@ -117,6 +117,7 @@ If two or more peers have same name, <sharp>number is appended to the name. (for
*
**chat_add_user**
\<
chat
\>
\<
user
\>
- add user to chat
*
**chat_del_user**
\<
chat
\>
\<
user
\>
- remove user from chat
*
**rename_chat**
\<
chat
\>
\<
new-name
\>
*
**create_group_chat**
\<
user
\>
\<
chat topic
\>
- creates a groupchat with user, use chat_add_user to add more users
#### Search
...
...
interface.c
View file @
5f40cc4e
...
...
@@ -322,6 +322,7 @@ char *commands[] = {
"chat_with_peer"
,
"delete_msg"
,
"restore_msg"
,
"create_group_chat"
,
0
};
int
commands_flags
[]
=
{
...
...
@@ -371,6 +372,7 @@ int commands_flags[] = {
07
,
072
,
07
,
072
,
07
};
...
...
@@ -888,6 +890,7 @@ void interpreter (char *line UU) {
"mark_read <peer> - mark read all received messages with peer
\n
"
"add_contact <phone-number> <first-name> <last-name> - tries to add contact to contact-list by phone
\n
"
"create_secret_chat <user> - creates secret chat with this user
\n
"
"create_group_chat <user> <chat-topic> - creates group chat with this user, add more users with chat_add_user <user>
\n
"
"rename_contact <user> <first-name> <last-name> - tries to rename contact. If you have another device it will be a fight
\n
"
"suggested_contacts - print info about contacts, you have max common friends
\n
"
"visualize_key <secret_chat> - prints visualization of encryption key. You should compare it to your partner's one
\n
"
...
...
@@ -938,6 +941,15 @@ void interpreter (char *line UU) {
}
else
if
(
IS_WORD
(
"create_secret_chat"
))
{
GET_PEER
;
do_create_secret_chat
(
id
);
}
else
if
(
IS_WORD
(
"create_group_chat"
))
{
GET_PEER
;
int
t
;
char
*
s
=
next_token
(
&
t
);
if
(
!
s
)
{
printf
(
"Empty chat topic
\n
"
);
RET
;
}
do_create_group_chat
(
id
,
s
);
}
else
if
(
IS_WORD
(
"suggested_contacts"
))
{
do_get_suggested
();
}
else
if
(
IS_WORD
(
"status_online"
))
{
...
...
queries.c
View file @
5f40cc4e
...
...
@@ -2784,6 +2784,36 @@ void do_create_secret_chat (peer_id_t id) {
}
/* }}} */
/* {{{ Create group chat */
struct
query_methods
create_group_chat_methods
=
{
.
on_answer
=
fwd_msg_on_answer
};
void
do_create_group_chat
(
peer_id_t
id
,
char
*
chat_topic
)
{
assert
(
get_peer_type
(
id
)
==
PEER_USER
);
peer_t
*
U
=
user_chat_get
(
id
);
if
(
!
U
)
{
rprintf
(
"Can not create chat with unknown user
\n
"
);
return
;
}
clear_packet
();
out_int
(
CODE_messages_create_chat
);
out_int
(
CODE_vector
);
out_int
(
1
);
// Number of users, currently we support only 1 user.
if
(
U
&&
U
->
user
.
access_hash
)
{
out_int
(
CODE_input_user_foreign
);
out_int
(
get_peer_id
(
id
));
out_long
(
U
->
user
.
access_hash
);
}
else
{
out_int
(
CODE_input_user_contact
);
out_int
(
get_peer_id
(
id
));
}
out_string
(
chat_topic
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
create_group_chat_methods
,
0
);
}
/* }}} */
/* {{{ Delete msg */
int
delete_msg_on_answer
(
struct
query
*
q
UU
)
{
...
...
queries.h
View file @
5f40cc4e
...
...
@@ -84,6 +84,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
(
int
user_id
);
void
do_create_secret_chat
(
peer_id_t
id
);
void
do_create_group_chat
(
peer_id_t
id
,
char
*
chat_topic
);
void
do_get_suggested
(
void
);
struct
photo
;
...
...
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