aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-04-19 22:19:06 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-04-19 22:19:06 -0700
commit61ae52c5fbe8fbaf75adb148cd05c357590e8807 (patch)
treef723cfe191065b8e82b8a2cb66a19aae022b230e
parentd323394cf97afa79bc2a75f5f2dd0f88bf1b8fa4 (diff)
Renamed/slightly changed syntax of groupchat callback functions.
-rw-r--r--protocols/msn/sb.c24
-rw-r--r--protocols/nogaim.c10
-rw-r--r--protocols/nogaim.h19
-rw-r--r--protocols/oscar/oscar.c10
-rw-r--r--protocols/yahoo/yahoo.c22
5 files changed, 42 insertions, 43 deletions
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index c3eaef60..1693cb95 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -183,11 +183,11 @@ struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
/* Create the groupchat structure. */
g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
- sb->chat = serv_got_joined_chat( ic, buf );
+ sb->chat = imcb_chat_new( ic, buf );
/* Populate the channel. */
- if( sb->who ) add_chat_buddy( sb->chat, sb->who );
- add_chat_buddy( sb->chat, ic->acc->user );
+ if( sb->who ) imcb_chat_add_buddy( sb->chat, sb->who );
+ imcb_chat_add_buddy( sb->chat, ic->acc->user );
/* And make sure the switchboard doesn't look like a regular chat anymore. */
if( sb->who )
@@ -231,7 +231,7 @@ void msn_sb_destroy( struct msn_switchboard *sb )
if( sb->chat )
{
- serv_got_chat_left( sb->chat );
+ imcb_chat_removed( sb->chat );
}
if( sb->handler )
@@ -373,17 +373,17 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( num == 1 )
{
g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
- sb->chat = serv_got_joined_chat( ic, buf );
+ sb->chat = imcb_chat_new( ic, buf );
g_free( sb->who );
sb->who = NULL;
}
- add_chat_buddy( sb->chat, cmd[4] );
+ imcb_chat_add_buddy( sb->chat, cmd[4] );
if( num == tot )
{
- add_chat_buddy( sb->chat, ic->acc->user );
+ imcb_chat_add_buddy( sb->chat, ic->acc->user );
}
}
}
@@ -461,11 +461,11 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
/* This SB is a one-to-one chat right now, but someone else is joining. */
msn_sb_to_chat( sb );
- add_chat_buddy( sb->chat, cmd[1] );
+ imcb_chat_add_buddy( sb->chat, cmd[1] );
}
else if( sb->chat )
{
- add_chat_buddy( sb->chat, cmd[1] );
+ imcb_chat_add_buddy( sb->chat, cmd[1] );
sb->ready = 1;
}
else
@@ -515,7 +515,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( sb->chat )
{
- remove_chat_buddy( sb->chat, cmd[1], "" );
+ imcb_chat_remove_buddy( sb->chat, cmd[1], "" );
}
else
{
@@ -610,7 +610,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
}
else if( sb->chat )
{
- serv_got_chat_in( sb->chat, cmd[1], 0, body, 0 );
+ imcb_chat_msg( sb->chat, cmd[1], body, 0, 0 );
}
else
{
@@ -669,7 +669,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
}
else if( sb->chat )
{
- serv_got_chat_in( sb->chat, cmd[1], 0, buf, 0 );
+ imcb_chat_msg( sb->chat, cmd[1], buf, 0, 0 );
}
else
{
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 2fa6277e..c27a684d 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -685,7 +685,7 @@ void imcb_buddy_typing( struct im_connection *ic, char *handle, u_int32_t flags
}
}
-void serv_got_chat_left( struct groupchat *c )
+void imcb_chat_removed( struct groupchat *c )
{
struct im_connection *ic = c->ic;
struct groupchat *l = NULL;
@@ -722,7 +722,7 @@ void serv_got_chat_left( struct groupchat *c )
}
}
-void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime )
+void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags, time_t sent_at )
{
struct im_connection *ic = c->ic;
user_t *u;
@@ -743,7 +743,7 @@ void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, t
imcb_log( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
}
-struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )
+struct groupchat *imcb_chat_new( struct im_connection *ic, char *handle )
{
struct groupchat *c;
@@ -770,7 +770,7 @@ struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )
/* buddy_chat.c */
-void add_chat_buddy( struct groupchat *b, char *handle )
+void imcb_chat_add_buddy( struct groupchat *b, char *handle )
{
user_t *u = user_findhandle( b->ic, handle );
int me = 0;
@@ -804,7 +804,7 @@ void add_chat_buddy( struct groupchat *b, char *handle )
}
}
-void remove_chat_buddy( struct groupchat *b, char *handle, char *reason )
+void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason )
{
user_t *u;
int me = 0;
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index e17c9523..c4b079ab 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -93,7 +93,6 @@ struct im_connection
struct groupchat *conversations;
};
-/* struct buddy_chat went away and got merged with this. */
struct groupchat {
struct im_connection *ic;
@@ -190,15 +189,6 @@ G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... );
G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname );
-/* Groupchats */
-G_MODULE_EXPORT void add_chat_buddy( struct groupchat *b, char *handle );
-G_MODULE_EXPORT void remove_chat_buddy( struct groupchat *b, char *handle, char *reason );
-G_MODULE_EXPORT void serv_got_chat_invite( struct im_connection *ic, char *handle, char *who, char *msg, GList *data );
-G_MODULE_EXPORT struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle );
-G_MODULE_EXPORT void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime );
-G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c );
-struct groupchat *chat_by_channel( char *channel );
-
/* Buddy management */
G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group );
G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group );
@@ -211,6 +201,15 @@ G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *ha
G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, u_int32_t flags, time_t sent_at );
G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, u_int32_t flags );
+/* Groupchats */
+G_MODULE_EXPORT void imcb_chat_invited( struct im_connection *ic, char *handle, char *who, char *msg, GList *data );
+G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle );
+G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason );
+G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags, time_t sent_at );
+G_MODULE_EXPORT void imcb_chat_removed( struct groupchat *c );
+struct groupchat *chat_by_channel( char *channel );
+
/* Actions, or whatever. */
int imc_set_away( struct im_connection *ic, char *away );
int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 7e5dbee0..a23e8a5a 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -749,7 +749,7 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
chatcon = find_oscar_chat_by_conn(ic, fr->conn);
chatcon->id = id;
- chatcon->cnv = serv_got_joined_chat(ic, chatcon->show);
+ chatcon->cnv = imcb_chat_new(ic, chatcon->show);
chatcon->cnv->data = chatcon;
return 1;
@@ -1460,7 +1460,7 @@ static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
return 1;
for (i = 0; i < count; i++)
- add_chat_buddy(c->cnv, info[i].sn);
+ imcb_chat_add_buddy(c->cnv, info[i].sn);
return 1;
}
@@ -1483,7 +1483,7 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
return 1;
for (i = 0; i < count; i++)
- remove_chat_buddy(c->cnv, info[i].sn, NULL);
+ imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL);
return 1;
}
@@ -1534,7 +1534,7 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
tmp = g_malloc(BUF_LONG);
g_snprintf(tmp, BUF_LONG, "%s", msg);
- serv_got_chat_in(ccon->cnv, info->sn, 0, tmp, time((time_t)NULL));
+ imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);
g_free(tmp);
return 1;
@@ -2512,7 +2512,7 @@ void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
struct oscar_data *od = (struct oscar_data *)ic->proto_data;
/* Notify the conversation window that we've left the chat */
- serv_got_chat_left(cc->cnv);
+ imcb_chat_removed(cc->cnv);
/* Destroy the chat_connection */
od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index c3d57a94..7bf3f333 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -145,7 +145,7 @@ static void byahoo_logout( struct im_connection *ic )
GSList *l;
while( ic->conversations )
- serv_got_chat_left( ic->conversations );
+ imcb_chat_removed( ic->conversations );
for( l = yd->buddygroups; l; l = l->next )
{
@@ -317,7 +317,7 @@ static void byahoo_chat_leave( struct groupchat *c )
struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
yahoo_conference_logoff( yd->y2_id, NULL, c->data, c->title );
- serv_got_chat_left( c );
+ imcb_chat_removed( c );
}
static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
@@ -329,8 +329,8 @@ static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
roomname = g_strdup_printf( "%s-Bee-%d", ic->acc->user, byahoo_chat_id );
- c = serv_got_joined_chat( ic, roomname );
- add_chat_buddy( c, ic->acc->user );
+ c = imcb_chat_new( ic, roomname );
+ imcb_chat_add_buddy( c, ic->acc->user );
/* FIXME: Free this thing when the chat's destroyed. We can't *always*
do this because it's not always created here. */
@@ -789,7 +789,7 @@ int ext_yahoo_connect(const char *host, int port)
static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv )
{
yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
- add_chat_buddy( inv->c, inv->ic->acc->user );
+ imcb_chat_add_buddy( inv->c, inv->ic->acc->user );
g_free( inv->name );
g_free( inv );
}
@@ -797,7 +797,7 @@ static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv )
static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv )
{
yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" );
- serv_got_chat_left( inv->c );
+ imcb_chat_removed( inv->c );
g_free( inv->name );
g_free( inv );
}
@@ -813,7 +813,7 @@ void ext_yahoo_got_conf_invite( int id, const char *ignored,
inv = g_malloc( sizeof( struct byahoo_conf_invitation ) );
memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
inv->name = g_strdup( room );
- inv->c = serv_got_joined_chat( ic, (char*) room );
+ inv->c = imcb_chat_new( ic, (char*) room );
inv->c->data = members;
inv->yid = id;
inv->members = members;
@@ -821,7 +821,7 @@ void ext_yahoo_got_conf_invite( int id, const char *ignored,
for( m = members; m; m = m->next )
if( g_strcasecmp( m->data, ic->acc->user ) != 0 )
- add_chat_buddy( inv->c, m->data );
+ imcb_chat_add_buddy( inv->c, m->data );
g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );
@@ -843,7 +843,7 @@ void ext_yahoo_conf_userjoin( int id, const char *ignored, const char *who, cons
for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
- add_chat_buddy( c, (char*) who );
+ imcb_chat_add_buddy( c, (char*) who );
}
void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, const char *room )
@@ -855,7 +855,7 @@ void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, con
for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
- remove_chat_buddy( c, (char*) who, "" );
+ imcb_chat_remove_buddy( c, (char*) who, "" );
}
void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const char *room, const char *msg, int utf8 )
@@ -867,7 +867,7 @@ void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const
for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
- serv_got_chat_in( c, (char*) who, 0, (char*) m, 0 );
+ imcb_chat_msg( c, (char*) who, (char*) m, 0, 0 );
g_free( m );
}