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
9a494d8f
Commit
9a494d8f
authored
Oct 25, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added #num to contacts with duplicate names
parent
2961f108
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
queries.c
queries.c
+4
-0
structures.c
structures.c
+46
-1
No files found.
queries.c
View file @
9a494d8f
...
...
@@ -453,6 +453,10 @@ int get_contacts_on_answer (struct query *q UU) {
push_color
(
COLOR_GREEN
);
printf
(
" ("
);
printf
(
"%s"
,
U
->
print_name
);
if
(
U
->
phone
)
{
printf
(
" "
);
printf
(
"%s"
,
U
->
phone
);
}
printf
(
") "
);
pop_color
();
if
(
U
->
status
.
online
>
0
)
{
...
...
structures.c
View file @
9a494d8f
...
...
@@ -23,6 +23,7 @@
#include "tree.h"
#include "loop.h"
int
verbosity
;
union
user_chat
*
Peers
[
MAX_USER_NUM
];
void
fetch_file_location
(
struct
file_location
*
loc
)
{
int
x
=
fetch_int
();
...
...
@@ -60,6 +61,9 @@ void fetch_user_status (struct user_status *S) {
}
int
our_id
;
int
user_num
;
int
chat_num
;
void
fetch_user
(
struct
user
*
U
)
{
unsigned
x
=
fetch_int
();
assert
(
x
==
CODE_user_empty
||
x
==
CODE_user_self
||
x
==
CODE_user_contact
||
x
==
CODE_user_request
||
x
==
CODE_user_foreign
||
x
==
CODE_user_deleted
);
...
...
@@ -100,6 +104,48 @@ void fetch_user (struct user *U) {
if
(
*
s
==
' '
)
{
*
s
=
'_'
;
}
s
++
;
}
int
cc
=
0
;
while
(
1
)
{
int
ok
=
1
;
int
i
;
for
(
i
=
0
;
i
<
user_num
+
chat_num
;
i
++
)
{
if
(
Peers
[
i
]
!=
(
void
*
)
U
&&
!
strcmp
(
Peers
[
i
]
->
print_name
,
U
->
print_name
))
{
ok
=
0
;
break
;
}
}
if
(
ok
)
{
break
;
}
cc
++
;
assert
(
cc
<=
99
);
if
(
cc
==
1
)
{
int
l
=
strlen
(
U
->
print_name
);
char
*
s
=
malloc
(
l
+
3
);
memcpy
(
s
,
U
->
print_name
,
l
);
s
[
l
+
2
]
=
0
;
s
[
l
]
=
'#'
;
s
[
l
+
1
]
=
'1'
;
free
(
U
->
print_name
);
U
->
print_name
=
s
;
}
else
if
(
cc
==
10
)
{
int
l
=
strlen
(
U
->
print_name
);
char
*
s
=
malloc
(
l
+
2
);
memcpy
(
s
,
U
->
print_name
,
l
);
s
[
l
+
1
]
=
0
;
s
[
l
]
=
'0'
;
s
[
l
-
1
]
=
'1'
;
free
(
U
->
print_name
);
U
->
print_name
=
s
;
}
else
{
int
l
=
strlen
(
U
->
print_name
);
U
->
print_name
[
l
-
1
]
++
;
if
(
U
->
print_name
[
l
-
1
]
>
'9'
)
{
U
->
print_name
[
l
-
1
]
=
'0'
;
U
->
print_name
[
l
-
2
]
++
;
}
}
}
if
(
x
==
CODE_user_deleted
)
{
U
->
flags
|=
FLAG_DELETED
;
return
;
...
...
@@ -443,7 +489,6 @@ int user_num;
int
users_allocated
;
int
chats_allocated
;
int
messages_allocated
;
union
user_chat
*
Peers
[
MAX_USER_NUM
];
struct
message
message_list
=
{
.
next_use
=
&
message_list
,
...
...
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