| 142 NMERR_T rc = NM_OK; |
142 NMERR_T rc = NM_OK; |
| 143 guint32 size = 0, flags = 0; |
143 guint32 size = 0, flags = 0; |
| 144 char *msg = NULL; |
144 char *msg = NULL; |
| 145 char *nortf = NULL; |
145 char *nortf = NULL; |
| 146 char *guid = NULL; |
146 char *guid = NULL; |
| |
147 GError *error = NULL; |
| 147 |
148 |
| 148 conn = nm_user_get_conn(user); |
149 conn = nm_user_get_conn(user); |
| 149 |
150 |
| 150 /* Read the conference guid */ |
151 /* Read the conference guid */ |
| 151 rc = nm_read_uint32(conn, &size); |
152 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 152 if (size > 1000) return NMERR_PROTOCOL; |
153 &error); |
| 153 |
154 if (size > 1000) { |
| 154 if (rc == NM_OK) { |
155 g_clear_error(&error); |
| |
156 return NMERR_PROTOCOL; |
| |
157 } |
| |
158 |
| |
159 if (error == NULL) { |
| 155 guid = g_new0(char, size + 1); |
160 guid = g_new0(char, size + 1); |
| 156 rc = nm_read_all(conn, guid, size); |
161 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| |
162 user->cancellable, &error); |
| 157 } |
163 } |
| 158 |
164 |
| 159 /* Read the conference flags */ |
165 /* Read the conference flags */ |
| 160 if (rc == NM_OK) { |
166 if (error == NULL) { |
| 161 rc = nm_read_uint32(conn, &flags); |
167 flags = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| |
168 &error); |
| 162 } |
169 } |
| 163 |
170 |
| 164 /* Read the message text */ |
171 /* Read the message text */ |
| 165 if (rc == NM_OK) { |
172 if (error == NULL) { |
| 166 rc = nm_read_uint32(conn, &size); |
173 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 167 if (size > 100000) return NMERR_PROTOCOL; |
174 &error); |
| 168 |
175 if (size > 100000) { |
| 169 if (rc == NM_OK) { |
176 g_clear_error(&error); |
| |
177 return NMERR_PROTOCOL; |
| |
178 } |
| |
179 |
| |
180 if (error == NULL) { |
| 170 msg = g_new0(char, size + 1); |
181 msg = g_new0(char, size + 1); |
| 171 rc = nm_read_all(conn, msg, size); |
182 g_input_stream_read_all(G_INPUT_STREAM(conn->input), msg, size, |
| |
183 NULL, user->cancellable, &error); |
| 172 |
184 |
| 173 purple_debug(PURPLE_DEBUG_INFO, "novell", "Message is %s\n", msg); |
185 purple_debug(PURPLE_DEBUG_INFO, "novell", "Message is %s\n", msg); |
| 174 |
186 |
| 175 /* Auto replies are not in RTF format! */ |
187 /* Auto replies are not in RTF format! */ |
| 176 if (!autoreply) { |
188 if (!autoreply) { |
| 190 |
202 |
| 191 /* Store the event data */ |
203 /* Store the event data */ |
| 192 nm_event_set_text(event, msg); |
204 nm_event_set_text(event, msg); |
| 193 } |
205 } |
| 194 } |
206 } |
| |
207 } |
| |
208 |
| |
209 if (error != NULL) { |
| |
210 if (error->code == G_IO_ERROR_CANCELLED) { |
| |
211 rc = NM_OK; |
| |
212 } else { |
| |
213 rc = NMERR_TCP_READ; |
| |
214 } |
| |
215 g_error_free(error); |
| |
216 return rc; |
| 195 } |
217 } |
| 196 |
218 |
| 197 /* Check to see if we already know about the conference */ |
219 /* Check to see if we already know about the conference */ |
| 198 conference = nm_conference_list_find(user, guid); |
220 conference = nm_conference_list_find(user, guid); |
| 199 if (conference) { |
221 if (conference) { |
| 258 guint32 size = 0; |
280 guint32 size = 0; |
| 259 char *guid = NULL; |
281 char *guid = NULL; |
| 260 char *msg = NULL; |
282 char *msg = NULL; |
| 261 NMConn *conn; |
283 NMConn *conn; |
| 262 NMUserRecord *user_record; |
284 NMUserRecord *user_record; |
| |
285 GError *error = NULL; |
| 263 |
286 |
| 264 conn = nm_user_get_conn(user); |
287 conn = nm_user_get_conn(user); |
| 265 |
288 |
| 266 /* Read the conference guid */ |
289 /* Read the conference guid */ |
| 267 rc = nm_read_uint32(conn, &size); |
290 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 268 if (size > 1000) return NMERR_PROTOCOL; |
291 &error); |
| 269 |
292 if (size > 1000) { |
| 270 if (rc == NM_OK) { |
293 g_clear_error(&error); |
| |
294 return NMERR_PROTOCOL; |
| |
295 } |
| |
296 |
| |
297 if (error == NULL) { |
| 271 guid = g_new0(char, size + 1); |
298 guid = g_new0(char, size + 1); |
| 272 rc = nm_read_all(conn, guid, size); |
299 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| |
300 user->cancellable, &error); |
| 273 } |
301 } |
| 274 |
302 |
| 275 /* Read the the message */ |
303 /* Read the the message */ |
| 276 if (rc == NM_OK) { |
304 if (error == NULL) { |
| 277 rc = nm_read_uint32(conn, &size); |
305 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 278 if (size > 100000) return NMERR_PROTOCOL; |
306 &error); |
| 279 |
307 if (size > 100000) { |
| 280 if (rc == NM_OK) { |
308 g_clear_error(&error); |
| |
309 return NMERR_PROTOCOL; |
| |
310 } |
| |
311 |
| |
312 if (error == NULL) { |
| 281 msg = g_new0(char, size + 1); |
313 msg = g_new0(char, size + 1); |
| 282 rc = nm_read_all(conn, msg, size); |
314 g_input_stream_read_all(G_INPUT_STREAM(conn->input), msg, size, |
| |
315 NULL, user->cancellable, &error); |
| 283 } |
316 } |
| 284 } |
317 } |
| 285 |
318 |
| 286 /* Store the event data */ |
319 /* Store the event data */ |
| 287 if (rc == NM_OK) { |
320 if (error == NULL) { |
| 288 NMConference *conference; |
321 NMConference *conference; |
| 289 |
322 |
| 290 nm_event_set_text(event, msg); |
323 nm_event_set_text(event, msg); |
| 291 |
324 |
| 292 conference = nm_conference_list_find(user, guid); |
325 conference = nm_conference_list_find(user, guid); |
| 334 guint32 size = 0; |
372 guint32 size = 0; |
| 335 char *guid = NULL; |
373 char *guid = NULL; |
| 336 NMConn *conn; |
374 NMConn *conn; |
| 337 NMConference *conference; |
375 NMConference *conference; |
| 338 NMUserRecord *user_record; |
376 NMUserRecord *user_record; |
| |
377 GError *error = NULL; |
| 339 |
378 |
| 340 conn = nm_user_get_conn(user); |
379 conn = nm_user_get_conn(user); |
| 341 |
380 |
| 342 /* Read the conference guid */ |
381 /* Read the conference guid */ |
| 343 rc = nm_read_uint32(conn, &size); |
382 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 344 if (size > 1000) return NMERR_PROTOCOL; |
383 &error); |
| 345 |
384 if (size > 1000) { |
| 346 if (rc == NM_OK) { |
385 g_clear_error(&error); |
| |
386 return NMERR_PROTOCOL; |
| |
387 } |
| |
388 |
| |
389 if (error == NULL) { |
| 347 guid = g_new0(char, size + 1); |
390 guid = g_new0(char, size + 1); |
| 348 rc = nm_read_all(conn, guid, size); |
391 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| |
392 user->cancellable, &error); |
| |
393 } |
| |
394 |
| |
395 if (error != NULL) { |
| |
396 if (error->code == G_IO_ERROR_CANCELLED) { |
| |
397 rc = NM_OK; |
| |
398 } else { |
| |
399 rc = NMERR_TCP_READ; |
| |
400 } |
| |
401 g_error_free(error); |
| |
402 return rc; |
| 349 } |
403 } |
| 350 |
404 |
| 351 conference = nm_conference_list_find(user, guid); |
405 conference = nm_conference_list_find(user, guid); |
| 352 if (conference) { |
406 if (conference) { |
| 353 nm_event_set_conference(event, conference); |
407 nm_event_set_conference(event, conference); |
| 385 NMERR_T rc = NM_OK; |
439 NMERR_T rc = NM_OK; |
| 386 guint32 size = 0; |
440 guint32 size = 0; |
| 387 char *guid = NULL; |
441 char *guid = NULL; |
| 388 NMConn *conn; |
442 NMConn *conn; |
| 389 NMConference *conference; |
443 NMConference *conference; |
| |
444 GError *error = NULL; |
| 390 |
445 |
| 391 conn = nm_user_get_conn(user); |
446 conn = nm_user_get_conn(user); |
| 392 |
447 |
| 393 /* Read the conference guid */ |
448 /* Read the conference guid */ |
| 394 rc = nm_read_uint32(conn, &size); |
449 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 395 if (size > 1000) return NMERR_PROTOCOL; |
450 &error); |
| 396 |
451 if (size > 1000) { |
| 397 if (rc == NM_OK) { |
452 g_clear_error(&error); |
| |
453 return NMERR_PROTOCOL; |
| |
454 } |
| |
455 |
| |
456 if (error == NULL) { |
| 398 guid = g_new0(char, size + 1); |
457 guid = g_new0(char, size + 1); |
| 399 rc = nm_read_all(conn, guid, size); |
458 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| 400 } |
459 user->cancellable, &error); |
| 401 |
460 } |
| 402 if (rc == NM_OK) { |
461 |
| |
462 if (error == NULL) { |
| 403 conference = nm_conference_list_find(user, guid); |
463 conference = nm_conference_list_find(user, guid); |
| 404 if (conference) { |
464 if (conference) { |
| 405 nm_event_set_conference(event, conference); |
465 nm_event_set_conference(event, conference); |
| 406 } else { |
466 } else { |
| 407 rc = NMERR_CONFERENCE_NOT_FOUND; |
467 rc = NMERR_CONFERENCE_NOT_FOUND; |
| 408 } |
468 } |
| |
469 } else { |
| |
470 if (error->code != G_IO_ERROR_CANCELLED) { |
| |
471 rc = NMERR_TCP_READ; |
| |
472 } |
| |
473 g_error_free(error); |
| 409 } |
474 } |
| 410 |
475 |
| 411 g_free(guid); |
476 g_free(guid); |
| 412 |
477 |
| 413 return rc; |
478 return rc; |
| 423 NMERR_T rc = NM_OK; |
488 NMERR_T rc = NM_OK; |
| 424 guint32 size = 0, flags = 0; |
489 guint32 size = 0, flags = 0; |
| 425 char *guid = NULL; |
490 char *guid = NULL; |
| 426 NMConference *conference; |
491 NMConference *conference; |
| 427 NMConn *conn; |
492 NMConn *conn; |
| |
493 GError *error = NULL; |
| 428 |
494 |
| 429 conn = nm_user_get_conn(user); |
495 conn = nm_user_get_conn(user); |
| 430 |
496 |
| 431 /* Read the conference guid */ |
497 /* Read the conference guid */ |
| 432 rc = nm_read_uint32(conn, &size); |
498 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 433 if (size > 1000) return NMERR_PROTOCOL; |
499 &error); |
| 434 |
500 if (size > 1000) { |
| 435 if (rc == NM_OK) { |
501 g_clear_error(&error); |
| |
502 return NMERR_PROTOCOL; |
| |
503 } |
| |
504 |
| |
505 if (error == NULL) { |
| 436 guid = g_new0(char, size + 1); |
506 guid = g_new0(char, size + 1); |
| 437 rc = nm_read_all(conn, guid, size); |
507 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| |
508 user->cancellable, &error); |
| 438 } |
509 } |
| 439 |
510 |
| 440 /* Read the conference flags */ |
511 /* Read the conference flags */ |
| 441 if (rc == NM_OK) { |
512 if (error == NULL) { |
| 442 rc = nm_read_uint32(conn, &flags); |
513 flags = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 443 } |
514 &error); |
| 444 |
515 } |
| 445 if (rc == NM_OK) { |
516 |
| |
517 if (error == NULL) { |
| 446 conference = nm_conference_list_find(user, guid); |
518 conference = nm_conference_list_find(user, guid); |
| 447 if (conference) { |
519 if (conference) { |
| 448 nm_event_set_conference(event, conference); |
520 nm_event_set_conference(event, conference); |
| 449 nm_conference_set_flags(conference, flags); |
521 nm_conference_set_flags(conference, flags); |
| 450 |
522 |
| 472 NMERR_T rc = NM_OK; |
549 NMERR_T rc = NM_OK; |
| 473 guint32 size = 0; |
550 guint32 size = 0; |
| 474 char *guid = NULL; |
551 char *guid = NULL; |
| 475 NMConference *conference; |
552 NMConference *conference; |
| 476 NMConn *conn; |
553 NMConn *conn; |
| |
554 GError *error = NULL; |
| 477 |
555 |
| 478 conn = nm_user_get_conn(user); |
556 conn = nm_user_get_conn(user); |
| 479 |
557 |
| 480 /* Read the conference guid */ |
558 /* Read the conference guid */ |
| 481 rc = nm_read_uint32(conn, &size); |
559 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 482 if (size > 1000) return NMERR_PROTOCOL; |
560 &error); |
| 483 |
561 if (size > 1000) { |
| 484 if (rc == NM_OK) { |
562 g_clear_error(&error); |
| |
563 return NMERR_PROTOCOL; |
| |
564 } |
| |
565 |
| |
566 if (error == NULL) { |
| 485 guid = g_new0(char, size + 1); |
567 guid = g_new0(char, size + 1); |
| 486 rc = nm_read_all(conn, guid, size); |
568 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| 487 } |
569 user->cancellable, &error); |
| 488 |
570 } |
| 489 if (rc == NM_OK) { |
571 |
| |
572 if (error == NULL) { |
| 490 conference = nm_conference_list_find(user, guid); |
573 conference = nm_conference_list_find(user, guid); |
| 491 if (conference) { |
574 if (conference) { |
| 492 nm_event_set_conference(event, conference); |
575 nm_event_set_conference(event, conference); |
| 493 nm_conference_list_remove(user, conference); |
576 nm_conference_list_remove(user, conference); |
| 494 } else { |
577 } else { |
| 495 rc = NMERR_CONFERENCE_NOT_FOUND; |
578 rc = NMERR_CONFERENCE_NOT_FOUND; |
| 496 } |
579 } |
| |
580 } else { |
| |
581 if (error->code != G_IO_ERROR_CANCELLED) { |
| |
582 rc = NMERR_TCP_READ; |
| |
583 } |
| |
584 g_error_free(error); |
| 497 } |
585 } |
| 498 |
586 |
| 499 g_free(guid); |
587 g_free(guid); |
| 500 |
588 |
| 501 return rc; |
589 return rc; |
| 511 guint32 size = 0, flags = 0; |
599 guint32 size = 0, flags = 0; |
| 512 char *guid = NULL; |
600 char *guid = NULL; |
| 513 NMConn *conn; |
601 NMConn *conn; |
| 514 NMConference *conference; |
602 NMConference *conference; |
| 515 NMUserRecord *user_record; |
603 NMUserRecord *user_record; |
| |
604 GError *error = NULL; |
| 516 |
605 |
| 517 conn = nm_user_get_conn(user); |
606 conn = nm_user_get_conn(user); |
| 518 |
607 |
| 519 /* Read the conference guid */ |
608 /* Read the conference guid */ |
| 520 rc = nm_read_uint32(conn, &size); |
609 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 521 if (size > 1000) return NMERR_PROTOCOL; |
610 &error); |
| 522 |
611 if (size > 1000) { |
| 523 if (rc == NM_OK) { |
612 g_clear_error(&error); |
| |
613 return NMERR_PROTOCOL; |
| |
614 } |
| |
615 |
| |
616 if (error == NULL) { |
| 524 guid = g_new0(char, size + 1); |
617 guid = g_new0(char, size + 1); |
| 525 rc = nm_read_all(conn, guid, size); |
618 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| |
619 user->cancellable, &error); |
| 526 } |
620 } |
| 527 |
621 |
| 528 /* Read the conference flags */ |
622 /* Read the conference flags */ |
| 529 if (rc == NM_OK) { |
623 if (error == NULL) { |
| 530 rc = nm_read_uint32(conn, &flags); |
624 flags = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 531 } |
625 &error); |
| 532 |
626 } |
| 533 if (rc == NM_OK) { |
627 |
| |
628 if (error == NULL) { |
| 534 conference = nm_conference_list_find(user, guid); |
629 conference = nm_conference_list_find(user, guid); |
| 535 if (conference) { |
630 if (conference) { |
| 536 nm_conference_set_flags(conference, flags); |
631 nm_conference_set_flags(conference, flags); |
| 537 |
632 |
| 538 nm_event_set_conference(event, conference); |
633 nm_event_set_conference(event, conference); |
| 569 NMERR_T rc = NM_OK; |
669 NMERR_T rc = NM_OK; |
| 570 guint32 size = 0; |
670 guint32 size = 0; |
| 571 char *guid = NULL; |
671 char *guid = NULL; |
| 572 NMConference *conference; |
672 NMConference *conference; |
| 573 NMConn *conn; |
673 NMConn *conn; |
| |
674 GError *error = NULL; |
| 574 |
675 |
| 575 conn = nm_user_get_conn(user); |
676 conn = nm_user_get_conn(user); |
| 576 |
677 |
| 577 /* Read the conference guid */ |
678 /* Read the conference guid */ |
| 578 rc = nm_read_uint32(conn, &size); |
679 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 579 if (size > 1000) return NMERR_PROTOCOL; |
680 &error); |
| 580 |
681 if (size > 1000) { |
| 581 if (rc == NM_OK) { |
682 g_clear_error(&error); |
| |
683 return NMERR_PROTOCOL; |
| |
684 } |
| |
685 |
| |
686 if (error == NULL) { |
| 582 guid = g_new0(char, size + 1); |
687 guid = g_new0(char, size + 1); |
| 583 rc = nm_read_all(conn, guid, size); |
688 g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, NULL, |
| 584 } |
689 user->cancellable, &error); |
| 585 |
690 } |
| 586 if (rc == NM_OK) { |
691 |
| |
692 if (error == NULL) { |
| 587 conference = nm_conference_list_find(user, guid); |
693 conference = nm_conference_list_find(user, guid); |
| 588 if (conference) { |
694 if (conference) { |
| 589 nm_event_set_conference(event, conference); |
695 nm_event_set_conference(event, conference); |
| 590 } else { |
696 } else { |
| 591 rc = NMERR_CONFERENCE_NOT_FOUND; |
697 rc = NMERR_CONFERENCE_NOT_FOUND; |
| 592 } |
698 } |
| |
699 } else { |
| |
700 if (error->code != G_IO_ERROR_CANCELLED) { |
| |
701 rc = NMERR_TCP_READ; |
| |
702 } |
| |
703 g_error_free(error); |
| 593 } |
704 } |
| 594 |
705 |
| 595 g_free(guid); |
706 g_free(guid); |
| 596 |
707 |
| 597 return rc; |
708 return rc; |
| 607 guint16 status; |
718 guint16 status; |
| 608 guint32 size; |
719 guint32 size; |
| 609 char *text = NULL; |
720 char *text = NULL; |
| 610 NMUserRecord *user_record; |
721 NMUserRecord *user_record; |
| 611 NMConn *conn; |
722 NMConn *conn; |
| |
723 GError *error = NULL; |
| 612 |
724 |
| 613 conn = nm_user_get_conn(user); |
725 conn = nm_user_get_conn(user); |
| 614 |
726 |
| 615 /* Read new status */ |
727 /* Read new status */ |
| 616 rc = nm_read_uint16(conn, &status); |
728 status = g_data_input_stream_read_uint16(conn->input, user->cancellable, |
| 617 if (rc == NM_OK) { |
729 &error); |
| |
730 if (error == NULL) { |
| 618 |
731 |
| 619 /* Read the status text */ |
732 /* Read the status text */ |
| 620 rc = nm_read_uint32(conn, &size); |
733 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 621 if (size > 10000) return NMERR_PROTOCOL; |
734 &error); |
| 622 |
735 if (size > 10000) { |
| 623 if (rc == NM_OK) { |
736 g_clear_error(&error); |
| |
737 return NMERR_PROTOCOL; |
| |
738 } |
| |
739 |
| |
740 if (error == NULL) { |
| 624 text = g_new0(char, size + 1); |
741 text = g_new0(char, size + 1); |
| 625 rc = nm_read_all(conn, text, size); |
742 g_input_stream_read_all(G_INPUT_STREAM(conn->input), text, size, |
| 626 } |
743 NULL, user->cancellable, &error); |
| 627 } |
744 } |
| 628 |
745 } |
| 629 if (rc == NM_OK) { |
746 |
| |
747 if (error == NULL) { |
| 630 nm_event_set_text(event, text); |
748 nm_event_set_text(event, text); |
| 631 |
749 |
| 632 /* Get a reference to the user record and store the new status */ |
750 /* Get a reference to the user record and store the new status */ |
| 633 user_record = nm_find_user_record(user, nm_event_get_source(event)); |
751 user_record = nm_find_user_record(user, nm_event_get_source(event)); |
| 634 if (user_record) { |
752 if (user_record) { |
| 635 nm_event_set_user_record(event, user_record); |
753 nm_event_set_user_record(event, user_record); |
| 636 nm_user_record_set_status(user_record, status, text); |
754 nm_user_record_set_status(user_record, status, text); |
| 637 } |
755 } |
| |
756 } else { |
| |
757 if (error->code != G_IO_ERROR_CANCELLED) { |
| |
758 rc = NMERR_TCP_READ; |
| |
759 } |
| |
760 g_error_free(error); |
| 638 } |
761 } |
| 639 |
762 |
| 640 g_free(text); |
763 g_free(text); |
| 641 |
764 |
| 642 return rc; |
765 return rc; |
| 648 { |
771 { |
| 649 NMERR_T rc = NM_OK; |
772 NMERR_T rc = NM_OK; |
| 650 guint32 size = 0; |
773 guint32 size = 0; |
| 651 char *guid = NULL; |
774 char *guid = NULL; |
| 652 NMConn *conn; |
775 NMConn *conn; |
| |
776 GError *error = NULL; |
| 653 |
777 |
| 654 conn = nm_user_get_conn(user); |
778 conn = nm_user_get_conn(user); |
| 655 |
779 |
| 656 /* Read the conference guid */ |
780 /* Read the conference guid */ |
| 657 rc = nm_read_uint32(conn, &size); |
781 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 658 if (size > 1000) return NMERR_PROTOCOL; |
782 &error); |
| 659 |
783 if (size > 1000) { |
| 660 if (rc == NM_OK) { |
784 g_clear_error(&error); |
| |
785 return NMERR_PROTOCOL; |
| |
786 } |
| |
787 |
| |
788 if (error == NULL) { |
| 661 guid = g_new0(char, size + 1); |
789 guid = g_new0(char, size + 1); |
| 662 rc = nm_read_all(conn, guid, size); |
790 rc = g_input_stream_read_all(G_INPUT_STREAM(conn->input), guid, size, |
| |
791 NULL, user->cancellable, &error); |
| |
792 } else { |
| |
793 if (error->code != G_IO_ERROR_CANCELLED) { |
| |
794 rc = NMERR_TCP_READ; |
| |
795 } |
| |
796 g_error_free(error); |
| 663 } |
797 } |
| 664 |
798 |
| 665 g_free(guid); |
799 g_free(guid); |
| 666 |
800 |
| 667 return rc; |
801 return rc; |
| 801 guint32 size = 0; |
935 guint32 size = 0; |
| 802 NMEvent *event = NULL; |
936 NMEvent *event = NULL; |
| 803 char *source = NULL; |
937 char *source = NULL; |
| 804 nm_event_cb cb; |
938 nm_event_cb cb; |
| 805 NMConn *conn; |
939 NMConn *conn; |
| |
940 GError *error = NULL; |
| 806 |
941 |
| 807 if (user == NULL) |
942 if (user == NULL) |
| 808 return NMERR_BAD_PARM; |
943 return NMERR_BAD_PARM; |
| 809 |
944 |
| 810 if (type < NMEVT_START || type > NMEVT_STOP) |
945 if (type < NMEVT_START || type > NMEVT_STOP) |
| 811 return NMERR_PROTOCOL; |
946 return NMERR_PROTOCOL; |
| 812 |
947 |
| 813 conn = nm_user_get_conn(user); |
948 conn = nm_user_get_conn(user); |
| 814 |
949 |
| 815 /* Read the event source */ |
950 /* Read the event source */ |
| 816 rc = nm_read_uint32(conn, &size); |
951 size = g_data_input_stream_read_uint32(conn->input, user->cancellable, |
| 817 if (rc == NM_OK) { |
952 &error); |
| |
953 if (error == NULL) { |
| 818 if (size > 1000000) { |
954 if (size > 1000000) { |
| 819 /* Size is larger than our 1MB sanity check. Ignore it. */ |
955 /* Size is larger than our 1MB sanity check. Ignore it. */ |
| 820 rc = NMERR_PROTOCOL; |
956 rc = NMERR_PROTOCOL; |
| 821 } else { |
957 } else { |
| 822 source = g_new0(char, size); |
958 source = g_new0(char, size); |
| 823 |
959 |
| 824 rc = nm_read_all(conn, source, size); |
960 rc = g_input_stream_read_all(G_INPUT_STREAM(conn->input), source, |
| |
961 size, NULL, user->cancellable, &error); |
| 825 } |
962 } |
| 826 } |
963 } |
| 827 |
964 |
| 828 /* Read the event data */ |
965 /* Read the event data */ |
| 829 if (rc == NM_OK) { |
966 if (error == NULL) { |
| 830 event = nm_create_event(type, source, time(0)); |
967 event = nm_create_event(type, source, time(0)); |
| 831 |
968 |
| 832 if (event) { |
969 if (event) { |
| 833 |
970 |
| 834 switch (type) { |
971 switch (type) { |