Changeset fc0640e for protocols/jabber
- Timestamp:
- 2012-02-10T18:00:00Z (13 years ago)
- Branches:
- master
- Children:
- b5fe39b
- Parents:
- bb2d198
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
rbb2d198 rfc0640e 23 23 24 24 #include "jabber.h" 25 #include "sha1.h" 25 26 26 27 static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); … … 68 69 } 69 70 71 struct groupchat *jabber_chat_with( struct im_connection *ic, char *who ) 72 { 73 struct jabber_data *jd = ic->proto_data; 74 struct jabber_chat *jc; 75 struct groupchat *c; 76 sha1_state_t sum; 77 double now = gettime(); 78 char *uuid, *rjid, *cserv; 79 80 sha1_init( &sum ); 81 sha1_append( &sum, (uint8_t*) ic->acc->user, strlen( ic->acc->user ) ); 82 sha1_append( &sum, (uint8_t*) &now, sizeof( now ) ); 83 sha1_append( &sum, (uint8_t*) who, strlen( who ) ); 84 uuid = sha1_random_uuid( &sum ); 85 86 if( jd->flags & JFLAG_GTALK ) 87 cserv = g_strdup( "groupchat.google.com" ); 88 else 89 /* Guess... */ 90 cserv = g_strdup_printf( "conference.%s", jd->server ); 91 92 rjid = g_strdup_printf( "private-chat-%s@%s", uuid, cserv ); 93 g_free( uuid ); 94 g_free( cserv ); 95 96 c = jabber_chat_join( ic, rjid, jd->username, NULL ); 97 g_free( rjid ); 98 if( c == NULL ) 99 return NULL; 100 101 jc = c->data; 102 jc->invite = g_strdup( who ); 103 104 return c; 105 } 106 70 107 static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) 71 108 { … … 116 153 g_free( jc->my_full_jid ); 117 154 g_free( jc->name ); 155 g_free( jc->invite ); 118 156 g_free( jc ); 119 157 … … 283 321 } 284 322 323 if( bud == jc->me && jc->invite != NULL ) 324 { 325 char *msg = g_strdup_printf( "Please join me in room %s", jc->name ); 326 jabber_chat_invite( chat, jc->invite, msg ); 327 g_free( jc->invite ); 328 g_free( msg ); 329 jc->invite = NULL; 330 } 331 285 332 s = strchr( bud->ext_jid, '/' ); 286 333 if( s ) *s = 0; /* Should NEVER be NULL, but who knows... */ -
protocols/jabber/jabber.c
rbb2d198 rfc0640e 483 483 } 484 484 485 static struct groupchat *jabber_chat_with_( struct im_connection *ic, char *who ) 486 { 487 return jabber_chat_with( ic, who ); 488 } 489 485 490 static void jabber_chat_msg_( struct groupchat *c, char *message, int flags ) 486 491 { … … 635 640 ret->chat_leave = jabber_chat_leave_; 636 641 ret->chat_join = jabber_chat_join_; 642 ret->chat_with = jabber_chat_with_; 637 643 ret->chat_add_settings = jabber_chat_add_settings; 638 644 ret->chat_free_settings = jabber_chat_free_settings; -
protocols/jabber/jabber.h
rbb2d198 rfc0640e 163 163 char *my_full_jid; /* Separate copy because of case sensitivity. */ 164 164 struct jabber_buddy *me; 165 char *invite; 165 166 }; 166 167 … … 339 340 /* conference.c */ 340 341 struct groupchat *jabber_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password ); 342 struct groupchat *jabber_chat_with( struct im_connection *ic, char *who ); 341 343 struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name ); 342 344 void jabber_chat_free( struct groupchat *c );
Note: See TracChangeset
for help on using the changeset viewer.