static void _elim_chat_add_users       ( PurpleConversation *conv         ,
                                         GList              *cbuddies     ,
                                         gboolean            new_arrivals )
{
    char    *ID    = new_elim_id();
    xmlnode *args  = xnode_new( "alist" );
    xmlnode *list  = xnode_new( "list"  );
    xmlnode *mcall = func_call( "elim-chat-add-users", ID, args );
    g_free( ID );
    fprintf( stderr, "(_elim_chat_add_users)\n" );

    _elim_conv_args( args, conv );
    AL_BOOL( args, "new-arrivals" , new_arrivals );
    AL_NODE( args, "participants" , list         );

    fprintf( stderr, "(_elim_chat_add_users)\n" );

    for( ; cbuddies; cbuddies = cbuddies->next )
    {
        xmlnode             *cbuddy = xnode_new( "alist" );
        PurpleConvChatBuddy *pccb   = cbuddies->data;

        AL_STR ( cbuddy, "name"     , pccb->name      ? pccb->name      : "" );
        AL_STR ( cbuddy, "alias"    , pccb->alias     ? pccb->alias     : "" );
        AL_STR ( cbuddy, "alias-key", pccb->alias_key ? pccb->alias_key : "" );
        AL_ENUM( cbuddy, "flags"    , pccb->flags , ":conv-chat-buddy-flags" );
        AL_BOOL( cbuddy, "on-blist" , pccb->buddy );

        xnode_insert_child( list, cbuddy );
    }

    add_outbound_sexp( mcall );
    fprintf( stderr, "(_elim_chat_add_users:DONE)\n" );
}
Example #2
0
xmlnode * func_call ( const char *name, const char *id, xmlnode *args )
{
    xmlnode *mcall = xnode_new      ( "function-call" );
    xmlnode *meth  = xnode_new_child( mcall , name    );
    xnode_set_attrib( meth, "id", id );
    if( args )
        xnode_insert_child( mcall, args );
    return mcall;
}
Example #3
0
void __roomlist_add_list_field( gpointer _field, gpointer _parent )
{
    g_return_if_fail( _field && _parent );

    PurpleRoomlistField *field  = _field;
    xmlnode             *parent = _parent;
    xmlnode             *node   = xnode_new( "alist" );

    AL_ENUM( node , "field-type"  , field->type   , ":roomlist-field-type" );
    AL_STR ( node , "field-label" , field->label  );
    AL_STR ( node , "field-name"  , field->name   );
    AL_BOOL( node , "field-hidden", field->hidden );

    xnode_insert_child( parent, node );
}
Example #4
0
xmlnode * response_value( int         code  ,
                          const char *id    ,
                          const char *name  ,
                          xmlnode    *val   )
{
    GString *status = g_string_new    ( "" );
    xmlnode *mresp  = xnode_new       ( "function-response" );
    xmlnode *meth   = xnode_new_child ( mresp, name         );
    xmlnode *value  = xnode_new_child ( mresp, "alist"      );
    xmlnode *stat   = xnode_new_child ( value, "int"        );

    xnode_set_attrib      ( meth  , "id"  , id );
    xnode_set_attrib      ( stat  , "name", "status" );
    xnode_set_attrib      ( val   , "name", "value"  );

    g_string_append_printf( status, "%d"       , code );
    xnode_insert_data     ( stat  , status->str, -1   );
    g_string_free         ( status, TRUE  );

    xnode_insert_child    ( value , val   );

    return mresp;
}