libpurple/protocols/zephyr/ZAsyncLocate.c

branch
string-comparison-r2
changeset 38258
9a6551eba09c
parent 31955
384153346831
child 38259
c593fc9f5438
equal deleted inserted replaced
38257:1a294a6d2a57 38258:9a6551eba09c
7 * For copying and distribution information, see the file 7 * For copying and distribution information, see the file
8 * "mit-copyright.h". 8 * "mit-copyright.h".
9 */ 9 */
10 10
11 #include "internal.h" 11 #include "internal.h"
12 #include "util.h"
12 13
13 Code_t ZRequestLocations(user, zald, kind, auth) 14 Code_t ZRequestLocations(user, zald, kind, auth)
14 const char *user; 15 const char *user;
15 ZAsyncLocateData_t *zald; 16 ZAsyncLocateData_t *zald;
16 ZNotice_Kind_t kind; /* UNSAFE, UNACKED, or ACKED */ 17 ZNotice_Kind_t kind; /* UNSAFE, UNACKED, or ACKED */
75 if (notice->z_kind == SERVNAK) 76 if (notice->z_kind == SERVNAK)
76 return (ZERR_SERVNAK); 77 return (ZERR_SERVNAK);
77 78
78 /* flag ACKs as special */ 79 /* flag ACKs as special */
79 if (notice->z_kind == SERVACK && 80 if (notice->z_kind == SERVACK &&
80 !strcmp(notice->z_opcode, LOCATE_LOCATE)) { 81 purple_strequal(notice->z_opcode, LOCATE_LOCATE)) {
81 *nlocs = -1; 82 *nlocs = -1;
82 return(ZERR_NONE); 83 return(ZERR_NONE);
83 } 84 }
84 85
85 if (notice->z_kind != ACKED) 86 if (notice->z_kind != ACKED)
131 } 132 }
132 133
133 __locate_next = 0; 134 __locate_next = 0;
134 *nlocs = __locate_num; 135 *nlocs = __locate_num;
135 if (user) { 136 if (user) {
136 size_t len; 137 size_t len;
137 if (zald) { 138 if (zald) {
138 len = strlen(zald->user) + 1; 139 len = strlen(zald->user) + 1;
139 if ((*user = (char *) malloc(len)) == NULL) 140 if ((*user = (char *) malloc(len)) == NULL)
140 return(ENOMEM); 141 return(ENOMEM);
141 g_strlcpy(*user,zald->user,len); 142 g_strlcpy(*user,zald->user,len);

mercurial