Merge github.com:vysheng/tg

This commit is contained in:
vvaltman 2015-06-17 12:39:48 +03:00
commit b9447e6ae1
3 changed files with 8 additions and 1 deletions

View File

@ -192,6 +192,7 @@ If two or more peers have same name, <sharp>number is appended to the name. (for
* **stats** - just for debugging * **stats** - just for debugging
* **show_license** - prints contents of GPLv2 * **show_license** - prints contents of GPLv2
* **help** - prints this help * **help** - prints this help
* **get_self** - get our user info
#### Card #### Card
* **export_card** - print your 'card' that anyone can later use to import your contact * **export_card** - print your 'card' that anyone can later use to import your contact

View File

@ -881,6 +881,11 @@ void do_broadcast (struct command *command, int arg_num, struct arg args[], stru
/* {{{ EDITING SELF PROFILE */ /* {{{ EDITING SELF PROFILE */
void do_get_self(struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
if (ev) { ev->refcnt ++; }
tgl_do_get_user_info (TLS, TGL_MK_USER(TLS->our_id), 0, print_user_info_gw, ev);
}
void do_set_profile_photo (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { void do_set_profile_photo (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num == 1); assert (arg_num == 1);
if (ev) { ev->refcnt ++; } if (ev) { ev->refcnt ++; }
@ -1369,6 +1374,7 @@ struct command commands[MAX_COMMANDS_SIZE] = {
{"fwd", {ca_peer, ca_number, ca_period, ca_none}, do_fwd, "fwd <peer> <msg-id>+\tForwards message to peer. Forward to secret chats is forbidden", NULL}, {"fwd", {ca_peer, ca_number, ca_period, ca_none}, do_fwd, "fwd <peer> <msg-id>+\tForwards message to peer. Forward to secret chats is forbidden", NULL},
{"fwd_media", {ca_peer, ca_number, ca_none}, do_fwd_media, "fwd_media <peer> <msg-id>\tForwards message media to peer. Forward to secret chats is forbidden. Result slightly differs from fwd", NULL}, {"fwd_media", {ca_peer, ca_number, ca_none}, do_fwd_media, "fwd_media <peer> <msg-id>\tForwards message media to peer. Forward to secret chats is forbidden. Result slightly differs from fwd", NULL},
{"get_message", {ca_number, ca_none}, do_get_message, "get_message <msg-id>\tGet message by id", NULL}, {"get_message", {ca_number, ca_none}, do_get_message, "get_message <msg-id>\tGet message by id", NULL},
{"get_self", {ca_none}, do_get_self, "get_self \tGet our user info", NULL},
{"help", {ca_none}, do_help, "help\tPrints this help", NULL}, {"help", {ca_none}, do_help, "help\tPrints this help", NULL},
{"history", {ca_peer, ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_history, "history <peer> [limit] [offset]\tPrints messages with this peer (most recent message lower). Also marks messages as read", NULL}, {"history", {ca_peer, ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_history, "history <peer> [limit] [offset]\tPrints messages with this peer (most recent message lower). Also marks messages as read", NULL},
{"import_card", {ca_string, ca_none}, do_import_card, "import_card <card>\tGets user by card and prints it name. You can then send messages to him as usual", NULL}, {"import_card", {ca_string, ca_none}, do_import_card, "import_card <card>\tGets user by card and prints it name. You can then send messages to him as usual", NULL},

2
main.c
View File

@ -939,7 +939,7 @@ int main (int argc, char **argv) {
serv_addr.sun_family = AF_UNIX; serv_addr.sun_family = AF_UNIX;
snprintf (serv_addr.sun_path, 108, "%s", unix_socket); snprintf (serv_addr.sun_path, sizeof(serv_addr.sun_path), "%s", unix_socket);
if (bind (usfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) { if (bind (usfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
perror ("bind"); perror ("bind");