| 1141 } |
1141 } |
| 1142 |
1142 |
| 1143 case GG_NOTIFY_REPLY80: |
1143 case GG_NOTIFY_REPLY80: |
| 1144 { |
1144 { |
| 1145 struct gg_notify_reply80 *n = (void*) p; |
1145 struct gg_notify_reply80 *n = (void*) p; |
| 1146 unsigned int length = h->length, i = 0; |
1146 int length = h->length, i = 0; |
| 1147 |
1147 |
| 1148 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); |
1148 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); |
| 1149 |
1149 |
| 1150 e->type = GG_EVENT_NOTIFY60; |
1150 e->type = GG_EVENT_NOTIFY60; |
| 1151 e->event.notify60 = malloc(sizeof(*e->event.notify60)); |
1151 e->event.notify60 = malloc(sizeof(*e->event.notify60)); |
| 1152 |
|
| 1153 if (!e->event.notify60) { |
1152 if (!e->event.notify60) { |
| 1154 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); |
1153 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); |
| 1155 goto fail; |
1154 goto fail; |
| 1156 } |
1155 } |
| 1157 |
1156 |
| 1158 e->event.notify60[0].uin = 0; |
1157 e->event.notify60[0].uin = 0; |
| 1159 |
1158 |
| 1160 while (length >= sizeof(struct gg_notify_reply80)) { |
1159 while (length >= sizeof(struct gg_notify_reply80)) { |
| 1161 uint32_t descr_len; |
1160 uint32_t descr_len; |
| 1162 char *tmp; |
1161 char *tmp; |
| 1163 |
1162 |
| 1164 e->event.notify60[i].uin = gg_fix32(n->uin); |
1163 e->event.notify60[i].uin = gg_fix32(n->uin); |
| 1165 e->event.notify60[i].status = gg_fix32(n->status); |
1164 e->event.notify60[i].status = gg_fix32(n->status); |
| 1166 e->event.notify60[i].remote_ip = n->remote_ip; |
1165 e->event.notify60[i].remote_ip = n->remote_ip; |
| 1167 e->event.notify60[i].remote_port= gg_fix16(n->remote_port); |
1166 e->event.notify60[i].remote_port= gg_fix16(n->remote_port); |
| 1168 e->event.notify60[i].image_size = n->image_size; |
1167 e->event.notify60[i].image_size = n->image_size; |
| 1169 e->event.notify60[i].descr = NULL; |
1168 e->event.notify60[i].descr = NULL; |
| 1170 e->event.notify60[i].version = 0x00; /* not-supported */ |
1169 e->event.notify60[i].version = 0x00; /* not-supported */ |
| 1171 e->event.notify60[i].time = 0; /* not-supported */ |
1170 e->event.notify60[i].time = 0; /* not-supported */ |
| 1172 |
1171 |
| |
1172 |
| 1173 descr_len = gg_fix32(n->descr_len); |
1173 descr_len = gg_fix32(n->descr_len); |
| 1174 |
1174 |
| 1175 length -= sizeof(struct gg_notify_reply80); |
1175 length -= sizeof(struct gg_notify_reply80); |
| 1176 n = (void*) ((char*) n + sizeof(struct gg_notify_reply80)); |
1176 n = (void*) ((char*) n + sizeof(struct gg_notify_reply80)); |
| 1177 |
1177 |