Mercurial > pidgin.yaz
comparison src/protocols/sametime/meanwhile/srvc_place.c @ 12261:2edf5dc1b2ea
[gaim-migrate @ 14563]
Removed the dependancy on libgmp, opting to use the public domain libmpi code
instead. Bringing over updates to the places service which should fix some
crash bugs.
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Tue, 29 Nov 2005 23:31:40 +0000 |
parents | 40724851e95e |
children |
comparison
equal
deleted
inserted
replaced
12260:0a9574ed62cd | 12261:2edf5dc1b2ea |
---|---|
93 : msg_out_JOIN_PLACE (maybe create?) | 93 : msg_out_JOIN_PLACE (maybe create?) |
94 : state = JOINING | 94 : state = JOINING |
95 | 95 |
96 : msg_in_JOIN_RESPONSE (contains our place member ID and section ID) | 96 : msg_in_JOIN_RESPONSE (contains our place member ID and section ID) |
97 : msg_in_INFO (for place, not peer) | 97 : msg_in_INFO (for place, not peer) |
98 : msg_in_UNKNOWNa | |
99 : state = JOINED | 98 : state = JOINED |
100 | 99 |
101 : msg_out_SECTION_LIST (asking for all sections) (optional) | 100 : msg_out_SECTION_LIST (asking for all sections) (optional) |
102 : msg_in_SECTION_LIST (listing all sections, as requested above) | 101 : msg_in_SECTION_LIST (listing all sections, as requested above) |
103 | 102 |
107 : msg_out_SECTION_LIST (with our section ID) (sorta optional) | 106 : msg_out_SECTION_LIST (with our section ID) (sorta optional) |
108 : msg_in_SECTION_LIST (section listing as requested above) | 107 : msg_in_SECTION_LIST (section listing as requested above) |
109 | 108 |
110 : msg_out_UNKNOWNb | 109 : msg_out_UNKNOWNb |
111 : msg_in_SECTION_PEER_JOINED (empty, with our place member ID) | 110 : msg_in_SECTION_PEER_JOINED (empty, with our place member ID) |
112 : msg_in_UNKNOWNa | |
113 : state = OPEN | 111 : state = OPEN |
114 | 112 |
115 : stuff... (invites, joins, parts, messages, attr) | 113 : stuff... (invites, joins, parts, messages, attr) |
116 | 114 |
117 : state = CLOSING | 115 : state = CLOSING |
271 | 269 |
272 return ret; | 270 return ret; |
273 } | 271 } |
274 | 272 |
275 | 273 |
274 static int send_SECTION_LIST(struct mwPlace *place, guint32 section) { | |
275 int ret = 0; | |
276 struct mwOpaque o = {0, 0}; | |
277 struct mwPutBuffer *b; | |
278 | |
279 b = mwPutBuffer_new(); | |
280 guint16_put(b, msg_out_SECTION_LIST); | |
281 guint32_put(b, section); | |
282 gboolean_put(b, FALSE); | |
283 guint32_put(b, ++place->requests); | |
284 mwPutBuffer_finalize(&o, b); | |
285 | |
286 ret = mwChannel_send(place->channel, msg_out_SECTION, &o); | |
287 mwOpaque_clear(&o); | |
288 | |
289 return ret; | |
290 } | |
291 | |
292 | |
276 static int recv_INFO(struct mwPlace *place, | 293 static int recv_INFO(struct mwPlace *place, |
277 struct mwGetBuffer *b) { | 294 struct mwGetBuffer *b) { |
278 | 295 |
279 int ret = 0; | 296 int ret = 0; |
280 guint32 skip = 0; | 297 guint32 skip = 0; |
287 if(! section) { | 304 if(! section) { |
288 /* this is a place info rather than member info */ | 305 /* this is a place info rather than member info */ |
289 if(place->title) g_free(place->title); | 306 if(place->title) g_free(place->title); |
290 mwGetBuffer_advance(b, 2); | 307 mwGetBuffer_advance(b, 2); |
291 mwString_get(b, &place->title); | 308 mwString_get(b, &place->title); |
309 | |
310 place_state(place, mwPlace_JOINED); | |
311 ret = send_SECTION_LIST(place, place->section); | |
292 } | 312 } |
293 | 313 |
294 return ret; | 314 return ret; |
295 } | 315 } |
296 | 316 |
305 char *msg = NULL; | 325 char *msg = NULL; |
306 int ret = 0; | 326 int ret = 0; |
307 | 327 |
308 srvc = place->service; | 328 srvc = place->service; |
309 | 329 |
330 /* no messages before becoming fully open, please */ | |
331 g_return_val_if_fail(place->state == mwPlace_OPEN, -1); | |
332 | |
310 /* regarding unkn_a and unkn_b: | 333 /* regarding unkn_a and unkn_b: |
311 | 334 |
312 they're probably a section indicator and a message count, I'm | 335 they're probably a section indicator and a message count, I'm |
313 just not sure which is which. Until this implementation supports | 336 just not sure which is which. Until this implementation supports |
314 place sections in the API, it really doesn't matter. */ | 337 place sections in the API, it really doesn't matter. */ |
329 srvc->handler->message(place, &pm->idb, msg); | 352 srvc->handler->message(place, &pm->idb, msg); |
330 | 353 |
331 g_free(msg); | 354 g_free(msg); |
332 | 355 |
333 return ret; | 356 return ret; |
357 } | |
358 | |
359 | |
360 static void place_opened(struct mwPlace *place) { | |
361 struct mwServicePlace *srvc; | |
362 | |
363 place_state(place, mwPlace_OPEN); | |
364 | |
365 srvc = place->service; | |
366 if(srvc->handler && srvc->handler->opened) | |
367 srvc->handler->opened(place); | |
334 } | 368 } |
335 | 369 |
336 | 370 |
337 static int recv_SECTION_PEER_JOIN(struct mwPlace *place, | 371 static int recv_SECTION_PEER_JOIN(struct mwPlace *place, |
338 struct mwGetBuffer *b) { | 372 struct mwGetBuffer *b) { |
363 | 397 |
364 PUT_MEMBER(place, pm); | 398 PUT_MEMBER(place, pm); |
365 if(srvc->handler && srvc->handler->peerJoined) | 399 if(srvc->handler && srvc->handler->peerJoined) |
366 srvc->handler->peerJoined(place, &pm->idb); | 400 srvc->handler->peerJoined(place, &pm->idb); |
367 | 401 |
402 if(pm->place_id == place->our_id) | |
403 place_opened(place); | |
404 | |
368 return ret; | 405 return ret; |
369 } | 406 } |
370 | 407 |
371 | 408 |
372 static int recv_SECTION_PEER_PART(struct mwPlace *place, | 409 static int recv_SECTION_PEER_PART(struct mwPlace *place, |
476 res = -1; | 513 res = -1; |
477 } | 514 } |
478 | 515 |
479 return res; | 516 return res; |
480 } | 517 } |
481 | |
482 | |
483 static void place_opened(struct mwPlace *place) { | |
484 struct mwServicePlace *srvc; | |
485 | |
486 place_state(place, mwPlace_OPEN); | |
487 | |
488 srvc = place->service; | |
489 if(srvc->handler && srvc->handler->opened) | |
490 srvc->handler->opened(place); | |
491 } | |
492 | |
493 | 518 |
494 | 519 |
495 static int recv_SECTION_LIST(struct mwPlace *place, | 520 static int recv_SECTION_LIST(struct mwPlace *place, |
496 struct mwGetBuffer *b) { | 521 struct mwGetBuffer *b) { |
497 int ret = 0; | 522 int ret = 0; |
584 | 609 |
585 return res; | 610 return res; |
586 } | 611 } |
587 | 612 |
588 | 613 |
589 static int send_SECTION_LIST(struct mwPlace *place, guint32 section) { | |
590 int ret = 0; | |
591 struct mwOpaque o = {0, 0}; | |
592 struct mwPutBuffer *b; | |
593 | |
594 b = mwPutBuffer_new(); | |
595 guint16_put(b, msg_out_SECTION_LIST); | |
596 guint32_put(b, section); | |
597 gboolean_put(b, FALSE); | |
598 guint32_put(b, ++place->requests); | |
599 mwPutBuffer_finalize(&o, b); | |
600 | |
601 ret = mwChannel_send(place->channel, msg_out_SECTION, &o); | |
602 mwOpaque_clear(&o); | |
603 | |
604 return ret; | |
605 } | |
606 | |
607 | |
608 static int recv_UNKNOWNa(struct mwPlace *place, struct mwGetBuffer *b) { | 614 static int recv_UNKNOWNa(struct mwPlace *place, struct mwGetBuffer *b) { |
609 int res = 0; | 615 int res = 0; |
610 | 616 |
611 if(place->state == mwPlace_JOINING) { | 617 if(place->state == mwPlace_JOINING) { |
612 place_state(place, mwPlace_JOINED); | 618 ; |
613 res = send_SECTION_LIST(place, place->section); | 619 /* place_state(place, mwPlace_JOINED); |
620 res = send_SECTION_LIST(place, place->section); */ | |
614 | 621 |
615 } else if(place->state == mwPlace_JOINED) { | 622 } else if(place->state == mwPlace_JOINED) { |
616 if(GET_MEMBER(place, place->our_id)) | 623 ; |
617 place_opened(place); | 624 /* if(GET_MEMBER(place, place->our_id)) |
625 place_opened(place); */ | |
618 } | 626 } |
619 | 627 |
620 return res; | 628 return res; |
621 } | 629 } |
622 | 630 |
657 mw_mailme_opaque(data, "Received unknown message type 0x%x on place %s", | 665 mw_mailme_opaque(data, "Received unknown message type 0x%x on place %s", |
658 type, NSTR(place->name)); | 666 type, NSTR(place->name)); |
659 } | 667 } |
660 | 668 |
661 if(res) { | 669 if(res) { |
662 mw_mailme_opaque(data, "Troubling parsing message type 0x0x on place %s", | 670 mw_mailme_opaque(data, "Troubling parsing message type 0x0%x on place %s", |
663 type, NSTR(place->name)); | 671 type, NSTR(place->name)); |
664 } | 672 } |
665 | 673 |
666 mwGetBuffer_free(b); | 674 mwGetBuffer_free(b); |
667 } | 675 } |