Changeset b20b32f


Ignore:
Timestamp:
2005-11-28T01:14:06Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
65e2ce1, cfcc587
Parents:
2cdd8ce (diff), dfde8e0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from Wilmer

Files:
2 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r2cdd8ce rb20b32f  
    1818
    1919all: $(OUTFILE)
     20        $(MAKE) -C doc
    2021
    2122uninstall: uninstall-bin uninstall-doc
     
    4142distclean: clean $(subdirs)
    4243        rm -f Makefile.settings config.h
    43         find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' | xargs rm -f
     44        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
    4445
    4546install-doc:
  • bitlbee.h

    r2cdd8ce rb20b32f  
    3030
    3131#define PACKAGE "BitlBee"
    32 #define BITLBEE_VERSION "0.99"
     32#define BITLBEE_VERSION "1.0pre"
    3333#define VERSION BITLBEE_VERSION
    3434
     
    8787
    8888#define DEFAULT_AWAY "Away from computer"
    89 #define CONTROL_TOPIC "Welcome to the control channel. Type help for help information."
     89#define CONTROL_TOPIC "Welcome to the control channel. Type \2help\2 for help information."
    9090#define IRCD_INFO "BitlBee <http://www.bitlbee.org/>"
    9191
  • crypting.c

    r2cdd8ce rb20b32f  
    5555#include <stdlib.h>
    5656
     57#define irc_usermsg
     58
    5759#endif
    5860
  • doc/CHANGES

    r2cdd8ce rb20b32f  
    88- HTML stripping is configurable again.
    99- Quit messages (at least on crashes) should appear again.
     10- Cleaned up some unnecessary code in the Jabber module, and implemented
     11  handlers for headline messages (which allows you to use RSS-to-Jabber
     12  gateways).
    1013
    1114Finished ...
  • doc/Makefile

    r2cdd8ce rb20b32f  
    11-include ../Makefile.settings
     2
     3all:
     4        # Only build the docs if this is a bzr checkout
     5        test ! -d ../.bzr || $(MAKE) -C user-guide
    26
    37install:
  • doc/bitlbee.8

    r2cdd8ce rb20b32f  
    3939networks and acts as a gateway. Users can connect to the server
    4040with any normal IRC client and see their 'buddy list' in
    41 #bitlbee. BitlBee's protocol support is based on the gaim
     41&bitlbee. BitlBee's protocol support is based on the gaim
    4242protocol plugins. BitlBee currently supports Oscar (aim and icq),
    4343MSN, Jabber and Yahoo.
     
    8686.SH COMMANDS
    8787To get a complete list of commands, please use the \fBhelp commands\fP
    88 command in the #bitlbee channel.
     88command in the &bitlbee channel.
    8989.SH "SEE ALSO"
    9090.BR ircd (8),
  • doc/user-guide/Usage.xml

    r2cdd8ce rb20b32f  
    1414
    1515<sect1>
    16 <title>The #bitlbee control channel</title>
     16<title>The &amp;bitlbee control channel</title>
    1717
    1818<para>
    1919Once you are connected to the BitlBee server, you are automatically joined
    20 to #bitlbee on that server. This channel acts like the 'buddy list' you have
     20to &amp;bitlbee on that server. This channel acts like the 'buddy list' you have
    2121on the various other chat networks.
    2222</para>
    2323
    2424<para>
    25 The user 'root' always hangs around in #bitlbee and acts as your interface
    26 to bitlbee. All commands you give on #bitlbee are 'answered' by root.
     25The user 'root' always hangs around in &amp;bitlbee and acts as your interface
     26to bitlbee. All commands you give on &amp;bitlbee are 'answered' by root.
     27</para>
     28
     29<para>
     30You might be slightly confused by the &amp; in the channel name. This is,
     31however, completely allowed by the IRC standards. Just try it on a regular
     32IRC server, it should work. The difference between the standard #channels
     33and &amp;channels is that the #channels are distributed over all the servers
     34on the IRC network, while &amp;channels are local to one server. Because
     35the BitlBee control channel is local to one server (and in fact, to one person),
     36this name seems more suitable. Also, with this name, it's harder to confuse
     37the control channel with the #bitlbee channel on OFTC.
    2738</para>
    2839
  • doc/user-guide/commands.xml

    r2cdd8ce rb20b32f  
    154154                <ircexample>
    155155                        <ircline nick="ctrlsoft">add 3 gryp@jabber.org grijp</ircline>
    156                         <ircaction nick="grijp" hostmask="gryp@jabber.org">has joined <emphasis>#bitlbee</emphasis></ircaction>
     156                        <ircaction nick="grijp" hostmask="gryp@jabber.org">has joined <emphasis>&amp;bitlbee</emphasis></ircaction>
    157157                </ircexample>
    158158        </bitlbee-command>
     
    357357                <description>
    358358                        <para>
    359                                 Some people prefer themself and root to have operator status in #bitlbee, other people don't. You can change these states using this setting.
     359                                Some people prefer themself and root to have operator status in &amp;bitlbee, other people don't. You can change these states using this setting.
    360360                        </para>
    361361
  • doc/user-guide/docbook.xsl

    r2cdd8ce rb20b32f  
    1919
    2020        <xsl:template match="ircaction">
    21                 <xsl:text> * </xsl:text><xsl:value-of select="@nick"/><xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;</xsl:text>
     21                <xsl:text> * </xsl:text><xsl:value-of select="@nick"/><xsl:text> </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;</xsl:text>
    2222        </xsl:template>
    2323
  • doc/user-guide/quickstart.xml

    r2cdd8ce rb20b32f  
    77
    88<para>
    9 The center of BitlBee is the control channel, <emphasis>#bitlbee</emphasis>. Two users will always be there, <emphasis>you</emphasis> (where "you" is the nickname you are using) and the system user, <emphasis>root</emphasis>.
     9The center of BitlBee is the control channel, <emphasis>&amp;bitlbee</emphasis>. Two users will always be there, <emphasis>you</emphasis> (where "you" is the nickname you are using) and the system user, <emphasis>root</emphasis>.
    1010</para>
    1111
     
    9797<ircexample>
    9898        <ircline nick="you">add 0 r2d2@example.com</ircline>
    99         <ircaction nick="r2d2"> has joined <emphasis>#bitlbee</emphasis></ircaction>
     99        <ircaction nick="r2d2"> has joined <emphasis>&amp;bitlbee</emphasis></ircaction>
    100100</ircexample>
    101101
     
    122122
    123123<para>
    124 First of all, a person must be on your contact list for you to chat with them (unless it's a group chat, <emphasis>help groupchats</emphasis> for more). If someone not on your contact list sends you a message, simply add them to the proper account with the <emphasis>add</emphasis> command. Once they are on your list and online, you can chat with them in #bitlbee:
     124First of all, a person must be on your contact list for you to chat with them (unless it's a group chat, <emphasis>help groupchats</emphasis> for more). If someone not on your contact list sends you a message, simply add them to the proper account with the <emphasis>add</emphasis> command. Once they are on your list and online, you can chat with them in &amp;bitlbee:
    125125</para>
    126126
     
    131131
    132132<para>
    133 If you'd rather chat with them in a separate window use the <emphasis>/msg</emphasis> or <emphasis>/query</emphasis> command, just like you would for a private message in IRC.  If you want to have messages automatically come up in private messages rather than in the #bitlbee channel, use the <emphasis>set private</emphasis> command: <emphasis>set private true</emphasis> (<emphasis>set private false</emphasis> to change back).
     133If you'd rather chat with them in a separate window use the <emphasis>/msg</emphasis> or <emphasis>/query</emphasis> command, just like you would for a private message in IRC.  If you want to have messages automatically come up in private messages rather than in the &amp;bitlbee channel, use the <emphasis>set private</emphasis> command: <emphasis>set private true</emphasis> (<emphasis>set private false</emphasis> to change back).
    134134</para>
    135135
  • irc.c

    r2cdd8ce rb20b32f  
    600600                else if ( irc->nick && g_strcasecmp( cmd[1], irc->nick ) == 0 )
    601601                {
    602                         irc_write( irc, ":%s!%s@%s PRIVMSG %s :%s", irc->nick, irc->user, irc->host, cmd[1], cmd[2] );
     602                        irc_write( irc, ":%s!%s@%s %s %s :%s", irc->nick, irc->user, irc->host, cmd[0], cmd[1], cmd[2] );
    603603                }
    604604                else
  • protocols/jabber/jabber.c

    r2cdd8ce rb20b32f  
    757757static void jabber_handlemessage(gjconn gjc, jpacket p)
    758758{
    759         xmlnode y, xmlns, subj, z;
     759        xmlnode y, xmlns, z;
    760760        time_t time_sent = time(NULL);
    761761
    762         char *from = NULL, *msg = NULL, *type = NULL, *topic = NULL;
     762        char *from = NULL, *msg = NULL, *type = NULL;
    763763        char m[BUF_LONG * 2];
    764764
     
    798798
    799799                if (type && !g_strcasecmp(type, "jabber:x:conference")) {
    800                         char *room;
    801                         GList *m = NULL;
    802                         char **data;
    803 
    804                         room = xmlnode_get_attrib(xmlns, "jid");
    805                         data = g_strsplit(room, "@", 2);
    806                         m = g_list_append(m, g_strdup(data[0]));
    807                         m = g_list_append(m, g_strdup(data[1]));
    808                         m = g_list_append(m, g_strdup(gjc->user->user));
    809                         g_strfreev(data);
    810 
    811                         /* ** Bitlbee ** serv_got_chat_invite(GJ_GC(gjc), room, from, msg, m); */
     800                        /* do nothing */
    812801                } else if (msg) { /* whisper */
    813802                        struct jabber_chat *jc;
     
    817806                        else {
    818807                                int flags = 0;
    819                                 /* ** Bitlbee **
    820                                 if (xmlnode_get_tag(p->x, "gaim"))
    821                                         flags = IM_FLAG_GAIMUSER;
    822                                 if (find_conversation(jid_full(p->from)))
    823                                         serv_got_im(GJ_GC(gjc), jid_full(p->from), m, flags, time_sent, -1);
    824                                 else {
    825                                 ** End - Bitlbee ** */
    826                                         if(p->from->user) {
    827                                             from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
    828                                         } else {
    829                                             /* server message? */
    830                                             from = g_strdup(p->from->server);
    831                                         }
    832                                         serv_got_im(GJ_GC(gjc), from, m, flags, time_sent, -1);
    833                                         g_free(from);
    834                                 /* ** Bitlbee ** } ** End - Bitlbee ** */
     808                               
     809                                if(p->from->user) {
     810                                    from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
     811                                } else {
     812                                    /* server message? */
     813                                    from = g_strdup(p->from->server);
     814                                }
     815                                serv_got_im(GJ_GC(gjc), from, m, flags, time_sent, -1);
     816                                g_free(from);
    835817                        }
    836818                }
     
    847829                        g_free(from);
    848830                }
    849         } else if (!g_strcasecmp(type, "groupchat")) {
    850                 struct jabber_chat *jc;
    851                 static int i = 0;
    852 
    853                 /*
    854                 if ((y = xmlnode_get_tag(p->x, "html"))) {
    855                         msg = xmlnode_get_data(y);
    856                 } else
    857                 */
    858                 if ((y = xmlnode_get_tag(p->x, "body"))) {
    859                         msg = xmlnode_get_data(y);
    860                 }
    861 
    862                 msg = utf8_to_str(msg);
     831        } else if (!g_strcasecmp(type, "headline")) {
     832                char *subject, *body, *url;
    863833               
    864                 if ((subj = xmlnode_get_tag(p->x, "subject"))) {
    865                         topic = xmlnode_get_data(subj);
    866                 }
    867                 topic = utf8_to_str(topic);
    868 
    869                 jc = find_existing_chat(GJ_GC(gjc), p->from);
    870                 if (!jc) {
    871                         /* we're not in this chat. are we supposed to be? */
    872                         if ((jc = find_pending_chat(GJ_GC(gjc), p->from)) != NULL) {
    873                                 /* yes, we're supposed to be. so now we are. */
    874                                 jc->b = serv_got_joined_chat(GJ_GC(gjc), i++, p->from->user);
    875                                 jc->id = jc->b->id;
    876                                 jc->state = JCS_ACTIVE;
    877                         } else {
    878                                 /* no, we're not supposed to be. */
    879                                 g_free(msg);
    880                                 return;
    881                         }
    882                 }
    883                 if (p->from->resource) {
    884                         if (!y) {
    885                                 if (!find_chat_buddy(jc->b, p->from->resource)) {
    886                                         add_chat_buddy(jc->b, p->from->resource);
    887                                 } else if ((y = xmlnode_get_tag(p->x, "status"))) {
    888                                         char *buf;
    889 
    890                                         buf = g_strdup_printf("%s@%s/%s",
    891                                                 p->from->user, p->from->server, p->from->resource);
    892                                         jabber_track_away(gjc, p, buf, NULL);
    893                                         g_free(buf);
    894 
    895                                 }
    896                         } else if (jc->b && msg) {
    897                                 char buf[8192];
    898 
    899                                 if (topic) {
    900                                         char tbuf[8192];
    901                                         g_snprintf(tbuf, sizeof(tbuf), "%s", topic);
    902                                 }
    903                                
    904 
    905                                 g_snprintf(buf, sizeof(buf), "%s", msg);
    906                                 serv_got_chat_in(GJ_GC(gjc), jc->b->id, p->from->resource, 0, buf, time_sent);
    907                         }
    908                 } else { /* message from the server */
    909                         if(jc->b && topic) {
    910                                 char tbuf[8192];
    911                                 g_snprintf(tbuf, sizeof(tbuf), "%s", topic);
    912                         }
    913                 }
    914 
    915                 g_free(msg);
    916                 g_free(topic);
    917 
     834                y = xmlnode_get_tag( p->x, "body" );
     835                body = y ? g_strdup( xmlnode_get_data( y ) ) : NULL;
     836               
     837                y = xmlnode_get_tag( p->x, "subject" );
     838                subject = y ? g_strdup( xmlnode_get_data( y ) ) : NULL;
     839               
     840                url = NULL;
     841                z = xmlnode_get_firstchild(p->x);
     842                while( z )
     843                {
     844                        char *xtype = xmlnode_get_attrib( z, "xmlns" );
     845                       
     846                        if( xtype && g_strcasecmp( xtype, "jabber:x:oob" ) == 0 &&
     847                                     ( y = xmlnode_get_tag( z, "url" ) ) )
     848                        {
     849                                url = g_strdup( xmlnode_get_data( y ) );
     850                                break;
     851                        }
     852                       
     853                        z = xmlnode_get_nextsibling( z );
     854                }
     855               
     856                g_snprintf( m, BUF_LONG, "Subject: %s\nURL: %s\nMessage:\n%s", subject ? subject : "(none)",
     857                                     url ? url : "(none)", body ? body : "(none)" );
     858
     859                if( p->from->user )
     860                        from = g_strdup_printf( "%s@%s", p->from->user, p->from->server );
     861                else
     862                        from = g_strdup( p->from->server );
     863               
     864                serv_got_im( GJ_GC(gjc), from, m, 0, time_sent, -1 );
     865               
     866                g_free( from );
     867                g_free( subject );
     868                g_free( body );
     869                g_free( url );
    918870        }
    919871}
  • protocols/nogaim.c

    r2cdd8ce rb20b32f  
    295295{
    296296        va_list params;
    297         char text[1024], buf[1024];
     297        char text[1024], buf[1024], acc_id[33];
    298298        char *msg;
     299        account_t *a;
    299300       
    300301        va_start( params, format );
     
    312313                strip_html( msg );
    313314       
    314         irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, msg );
     315        /* Try to find a different connection on the same protocol. */
     316        for( a = gc->irc->accounts; a; a = a->next )
     317                if( a->prpl == gc->prpl && a->gc != gc )
     318                        break;
     319       
     320        /* If we found one, add the screenname to the acc_id. */
     321        if( a )
     322                g_snprintf( acc_id, 32, "%s(%s)", gc->prpl->name, gc->username );
     323        else
     324                g_snprintf( acc_id, 32, "%s", gc->prpl->name );
     325       
     326        irc_usermsg( gc->irc, "%s - %s", acc_id, msg );
    315327}
    316328
     
    706718                msg = buf;
    707719       
    708         while( strlen( msg ) > 450 )
     720        while( strlen( msg ) > 425 )
    709721        {
    710722                char tmp, *nl;
    711723               
    712                 tmp = msg[450];
    713                 msg[450] = 0;
    714                
    715                 /* If there's a newline in this string, split up there so we're not
    716                    going to split up lines. If there isn't a newline, well, too bad. */
    717                 if( ( nl = strrchr( msg, '\n' ) ) )
     724                tmp = msg[425];
     725                msg[425] = 0;
     726               
     727                /* If there's a newline/space in this string, split up there,
     728                   looks a bit prettier. */
     729                if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strchr( msg, ' ' ) ) )
     730                {
     731                        msg[425] = tmp;
     732                        tmp = *nl;
    718733                        *nl = 0;
     734                }
    719735               
    720736                irc_msgfrom( irc, u->nick, msg );
    721                
    722                 msg[450] = tmp;
    723737               
    724738                /* Move on. */
    725739                if( nl )
    726740                {
    727                         *nl = '\n';
     741                        *nl = tmp;
    728742                        msg = nl + 1;
    729743                }
    730744                else
    731745                {
    732                         msg += 450;
     746                        msg[425] = tmp;
     747                        msg += 425;
    733748                }
    734749        }
     
    744759       
    745760        if( ( u = user_findhandle( gc, handle ) ) )
    746                 irc_noticefrom( gc->irc, u->nick, "* Typing a message *" );
     761                irc_msgfrom( gc->irc, u->nick, "\1TYPING 1\1" );
    747762}
    748763
  • protocols/oscar/Makefile

    r2cdd8ce rb20b32f  
    1010
    1111# [SH] Program variables
    12 objects = admin.o auth.o bos.o buddylist.o chat.o chatnav.o conn.o ft.o icq.o im.o info.o misc.o msgcookie.o rxhandlers.o rxqueue.o search.o service.o snac.o ssi.o stats.o tlv.o txqueue.o oscar_util.o oscar.o
     12objects = admin.o auth.o bos.o buddylist.o chat.o chatnav.o conn.o icq.o im.o info.o misc.o msgcookie.o rxhandlers.o rxqueue.o search.o service.o snac.o ssi.o stats.o tlv.o txqueue.o oscar_util.o oscar.o
    1313
    1414CFLAGS += -Wall
  • protocols/oscar/aim.h

    r2cdd8ce rb20b32f  
    168168#define AIM_CONN_TYPE_CHATNAV       0x000d
    169169
    170 /* they start getting arbitrary in rendezvous stuff =) */
    171 #define AIM_CONN_TYPE_RENDEZVOUS    0x0101 /* these do not speak FLAP! */
    172 #define AIM_CONN_TYPE_RENDEZVOUS_OUT 0x0102 /* socket waiting for accept() */
    173 
    174 /*
    175  * Subtypes, we need these for OFT stuff.
    176  */
    177 #define AIM_CONN_SUBTYPE_OFT_DIRECTIM  0x0001
    178 #define AIM_CONN_SUBTYPE_OFT_GETFILE   0x0002
    179 #define AIM_CONN_SUBTYPE_OFT_SENDFILE  0x0003
    180 #define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004
    181 #define AIM_CONN_SUBTYPE_OFT_VOICE     0x0005
    182 
    183170/*
    184171 * Status values returned from aim_conn_new().  ORed together.
     
    191178
    192179#define AIM_FRAMETYPE_FLAP 0x0000
    193 #define AIM_FRAMETYPE_OFT  0x0001
    194180
    195181/*
     
    258244                        flap_seqnum_t seqnum;     
    259245                } flap;
    260                 struct {
    261                         guint16 type;
    262                         guint8 magic[4]; /* ODC2 OFT2 */
    263                         guint16 hdr2len;
    264                         guint8 *hdr2; /* rest of bloated header */
    265                 } oft;
    266246        } hdr;
    267247        aim_bstream_t data;     /* payload stream */
     
    670650#define AIM_COOKIETYPE_CHATNAV  0x06
    671651#define AIM_COOKIETYPE_INVITE   0x07
    672 /* we'll move OFT up a bit to give breathing room.  not like it really
    673  * matters. */
    674 #define AIM_COOKIETYPE_OFTIM    0x10
    675 #define AIM_COOKIETYPE_OFTGET   0x11
    676 #define AIM_COOKIETYPE_OFTSEND  0x12
    677 #define AIM_COOKIETYPE_OFTVOICE 0x13
    678 #define AIM_COOKIETYPE_OFTIMAGE 0x14
    679 #define AIM_COOKIETYPE_OFTICON  0x15
    680652
    681653int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur);
  • protocols/oscar/aim_internal.h

    r2cdd8ce rb20b32f  
    192192aim_msgcookie_t *aim_checkcookie(aim_session_t *sess, const unsigned char *, const int);
    193193int aim_freecookie(aim_session_t *sess, aim_msgcookie_t *cookie);
    194 int aim_msgcookie_gettype(int reqclass);
    195194int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie);
    196195
  • protocols/oscar/conn.c

    r2cdd8ce rb20b32f  
    164164         * This will free ->internal if it necessary...
    165165         */
    166         if ((*deadconn)->type == AIM_CONN_TYPE_RENDEZVOUS)
    167                 aim_conn_kill_rend(sess, *deadconn);
    168         else if ((*deadconn)->type == AIM_CONN_TYPE_CHAT)
     166        if ((*deadconn)->type == AIM_CONN_TYPE_CHAT)
    169167                aim_conn_kill_chat(sess, *deadconn);
    170168
     
    314312        if (deadconn->handlerlist)
    315313                aim_clearhandlers(deadconn);
    316         if (deadconn->type == AIM_CONN_TYPE_RENDEZVOUS)
    317                 aim_conn_close_rend((aim_session_t *)deadconn->sessv, deadconn);
    318314
    319315        return;
  • protocols/oscar/im.c

    r2cdd8ce rb20b32f  
    20392039         */
    20402040        aimbs_put8(&fr->data, strlen(sn));
    2041         aimbs_putraw(&fr->data, sn, strlen(sn));
     2041        aimbs_putraw(&fr->data, (const guint8*)sn, strlen(sn));
    20422042
    20432043        /*
  • protocols/oscar/msgcookie.c

    r2cdd8ce rb20b32f  
    178178        return 0;
    179179}
    180 
    181 /* XXX I hate switch */
    182 int aim_msgcookie_gettype(int reqclass)
    183 {
    184         /* XXX: hokey-assed. needs fixed. */
    185         switch(reqclass) {
    186         case AIM_CAPS_BUDDYICON: return AIM_COOKIETYPE_OFTICON;
    187         case AIM_CAPS_VOICE: return AIM_COOKIETYPE_OFTVOICE;
    188         case AIM_CAPS_IMIMAGE: return AIM_COOKIETYPE_OFTIMAGE;
    189         case AIM_CAPS_CHAT: return AIM_COOKIETYPE_CHAT;
    190         case AIM_CAPS_GETFILE: return AIM_COOKIETYPE_OFTGET;
    191         case AIM_CAPS_SENDFILE: return AIM_COOKIETYPE_OFTSEND;
    192         default: return AIM_COOKIETYPE_UNKNOWN;
    193         }           
    194 }
    195 
    196 
  • protocols/oscar/oscar.c

    r2cdd8ce rb20b32f  
    275275
    276276        if (condition & GAIM_INPUT_READ) {
    277                 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
    278                         if (aim_handlerendconnect(odata->sess, conn) < 0) {
     277                if (aim_get_command(odata->sess, conn) >= 0) {
     278                        aim_rxdispatch(odata->sess);
     279                               if (odata->killme)
     280                                       signoff(gc);
     281                } else {
     282                        if ((conn->type == AIM_CONN_TYPE_BOS) ||
     283                                   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
     284                                hide_login_progress_error(gc, _("Disconnected."));
     285                                signoff(gc);
     286                        } else if (conn->type == AIM_CONN_TYPE_CHAT) {
     287                                struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
     288                                char buf[BUF_LONG];
     289                                c->conn = NULL;
     290                                if (c->inpa > 0)
     291                                        gaim_input_remove(c->inpa);
     292                                c->inpa = 0;
     293                                c->fd = -1;
    279294                                aim_conn_kill(odata->sess, &conn);
    280                         }
    281                 } else {
    282                         if (aim_get_command(odata->sess, conn) >= 0) {
    283                                 aim_rxdispatch(odata->sess);
    284                                 if (odata->killme)
    285                                         signoff(gc);
     295                                sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
     296                                do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
     297                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
     298                                if (odata->cnpa > 0)
     299                                        gaim_input_remove(odata->cnpa);
     300                                odata->cnpa = 0;
     301                                while (odata->create_rooms) {
     302                                        struct create_room *cr = odata->create_rooms->data;
     303                                        g_free(cr->name);
     304                                        odata->create_rooms =
     305                                                g_slist_remove(odata->create_rooms, cr);
     306                                        g_free(cr);
     307                                        do_error_dialog(sess->aux_data, _("Chat is currently unavailable"),
     308                                                        _("Gaim - Chat"));
     309                                }
     310                                aim_conn_kill(odata->sess, &conn);
     311                        } else if (conn->type == AIM_CONN_TYPE_AUTH) {
     312                                if (odata->paspa > 0)
     313                                        gaim_input_remove(odata->paspa);
     314                                odata->paspa = 0;
     315                                aim_conn_kill(odata->sess, &conn);
    286316                        } else {
    287                                 if ((conn->type == AIM_CONN_TYPE_BOS) ||
    288                                            !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
    289                                         hide_login_progress_error(gc, _("Disconnected."));
    290                                         signoff(gc);
    291                                 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
    292                                         struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
    293                                         char buf[BUF_LONG];
    294                                         c->conn = NULL;
    295                                         if (c->inpa > 0)
    296                                                 gaim_input_remove(c->inpa);
    297                                         c->inpa = 0;
    298                                         c->fd = -1;
    299                                         aim_conn_kill(odata->sess, &conn);
    300                                         sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
    301                                         do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
    302                                 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    303                                         if (odata->cnpa > 0)
    304                                                 gaim_input_remove(odata->cnpa);
    305                                         odata->cnpa = 0;
    306                                         while (odata->create_rooms) {
    307                                                 struct create_room *cr = odata->create_rooms->data;
    308                                                 g_free(cr->name);
    309                                                 odata->create_rooms =
    310                                                         g_slist_remove(odata->create_rooms, cr);
    311                                                 g_free(cr);
    312                                                 do_error_dialog(sess->aux_data, _("Chat is currently unavailable"),
    313                                                                 _("Gaim - Chat"));
    314                                         }
    315                                         aim_conn_kill(odata->sess, &conn);
    316                                 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
    317                                         if (odata->paspa > 0)
    318                                                 gaim_input_remove(odata->paspa);
    319                                         odata->paspa = 0;
    320                                         aim_conn_kill(odata->sess, &conn);
    321                                 } else {
    322                                         aim_conn_kill(odata->sess, &conn);
    323                                 }
     317                                aim_conn_kill(odata->sess, &conn);
    324318                        }
    325319                }
  • protocols/oscar/rxhandlers.c

    r2cdd8ce rb20b32f  
    341341                        continue;
    342342
    343                 /*
    344                  * This is a debugging/sanity check only and probably
    345                  * could/should be removed for stable code.
    346                  */
    347                 if (((cur->hdrtype == AIM_FRAMETYPE_OFT) &&
    348                    (cur->conn->type != AIM_CONN_TYPE_RENDEZVOUS)) ||
    349                   ((cur->hdrtype == AIM_FRAMETYPE_FLAP) &&
    350                    (cur->conn->type == AIM_CONN_TYPE_RENDEZVOUS))) {
    351                         do_error_dialog(sess->aux_data, "incompatible frame type/connection type combination", "Gaim");
    352                         cur->handled = 1;
    353                         continue;
    354                 }
    355 
    356                 if (cur->conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
    357                         if (cur->hdrtype != AIM_FRAMETYPE_OFT) {
    358                                 do_error_dialog(sess->aux_data, "non-OFT frames on OFT connection", "Gaim");
    359                                 cur->handled = 1; /* get rid of it */
    360                         } else {
    361                                 /* FIXME: implement this (OFT frame) */
    362                                 cur->handled = 1; /* get rid of it */
    363                         }
    364                         continue;
    365                 }
    366 
    367                 if (cur->conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
    368                         /* not possible */
    369                         do_error_dialog(sess->aux_data, "RENDEZVOUS packet in rxqueue", "Gaim");
    370                         cur->handled = 1;
    371                         continue;
    372                 }
    373 
    374343                if (cur->hdr.flap.type == 0x01) {
    375344                       
  • protocols/oscar/rxqueue.c

    r2cdd8ce rb20b32f  
    332332        g_free(frame->data.data); /* XXX aim_bstream_free */
    333333
    334         if (frame->hdrtype == AIM_FRAMETYPE_OFT)
    335                 g_free(frame->hdr.oft.hdr2);
    336334        g_free(frame);
    337        
    338         return;
    339335}
    340336
     
    362358        if (conn->status & AIM_CONN_STATUS_INPROGRESS)
    363359                return aim_conn_completeconnect(sess, conn);
    364 
    365         /*
    366          * Rendezvous (client-client) connections do not speak
    367          * FLAP, so this function will break on them.
    368          */
    369         if (conn->type == AIM_CONN_TYPE_RENDEZVOUS)
    370                 return aim_get_command_rendezvous(sess, conn);
    371         else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) {
    372                 do_error_dialog(sess->aux_data,"AIM_CONN_TYPE_RENDEZVOUS_OUT shouldn't use FLAP", "Gaim");
    373                 return 0;
    374         }
    375360
    376361        aim_bstream_init(&flaphdr, flaphdr_raw, sizeof(flaphdr_raw));
  • protocols/oscar/txqueue.c

    r2cdd8ce rb20b32f  
    3434        }
    3535
    36         /* For sanity... */
    37         if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) ||
    38                         (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT)) {
    39                 if (framing != AIM_FRAMETYPE_OFT) {
    40                         do_error_dialog(sess->aux_data, "attempted to allocate inappropriate frame type for rendezvous connection", "Gaim");
    41                         return NULL;
    42                 }
    43         } else {
    44                 if (framing != AIM_FRAMETYPE_FLAP) {
    45                         do_error_dialog(sess->aux_data, "attempted to allocate inappropriate frame type for FLAP connection", "Gaim");
    46                         return NULL;
    47                 }
    48         }
    49 
    5036        if (!(fr = (aim_frame_t *)g_new0(aim_frame_t,1)))
    5137                return NULL;
     
    5844
    5945                fr->hdr.flap.type = chan;
    60 
    61         } else if (fr->hdrtype == AIM_FRAMETYPE_OFT) {
    62 
    63                 fr->hdr.oft.type = chan;
    64                 fr->hdr.oft.hdr2len = 0; /* this will get setup by caller */
    6546
    6647        } else
     
    237218
    238219        if (count) {
    239                 if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) &&
    240                     (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM)) {
    241                         /* I strongly suspect that this is a horrible thing to do
    242                          * and I feel really guilty doing it. */
    243                         const char *sn = aim_directim_getsn(conn);
    244                         aim_rxcallback_t userfunc;
    245                         while (count - wrote > 1024) {
    246                                 wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, 1024);
    247                                 if ((userfunc=aim_callhandler(conn->sessv, conn,
    248                                                               AIM_CB_FAM_SPECIAL,
    249                                                               AIM_CB_SPECIAL_IMAGETRANSFER)))
    250                                   userfunc(conn->sessv, NULL, sn,
    251                                            count-wrote>1024 ? ((double)wrote / count) : 1);
    252                         }
    253                 }
    254220                if (count - wrote) {
    255221                        wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote);
     
    299265}
    300266
    301 static int sendframe_oft(aim_session_t *sess, aim_frame_t *fr)
    302 {
    303         aim_bstream_t hbs;
    304         guint8 *hbs_raw;
    305         int hbslen;
    306         int err = 0;
    307        
    308         hbslen = 8 + fr->hdr.oft.hdr2len;
    309         if (!(hbs_raw = g_malloc(hbslen)))
    310                 return -1;
    311 
    312         aim_bstream_init(&hbs, hbs_raw, hbslen);
    313 
    314         aimbs_putraw(&hbs, fr->hdr.oft.magic, 4);
    315         aimbs_put16(&hbs, fr->hdr.oft.hdr2len + 8);
    316         aimbs_put16(&hbs, fr->hdr.oft.type);
    317         aimbs_putraw(&hbs, fr->hdr.oft.hdr2, fr->hdr.oft.hdr2len);
    318 
    319         aim_bstream_rewind(&hbs);
    320        
    321        
    322         if (aim_bstream_send(&hbs, fr->conn, hbslen) != hbslen) {
    323 
    324                 err = -errno;
    325                
    326         } else if (aim_bstream_curpos(&fr->data)) {
    327                 int len;
    328 
    329                 len = aim_bstream_curpos(&fr->data);
    330                 aim_bstream_rewind(&fr->data);
    331                
    332                 if (aim_bstream_send(&fr->data, fr->conn, len) != len)
    333                         err = -errno;
    334         }
    335 
    336         g_free(hbs_raw); /* XXX aim_bstream_free */
    337 
    338         fr->handled = 1;
    339         fr->conn->lastactivity = time(NULL);
    340 
    341 
    342         return err;
    343 
    344 
    345 }
    346 
    347267int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr)
    348268{
    349269        if (fr->hdrtype == AIM_FRAMETYPE_FLAP)
    350270                return sendframe_flap(sess, fr);
    351         else if (fr->hdrtype == AIM_FRAMETYPE_OFT)
    352                 return sendframe_oft(sess, fr);
    353271        return -1;
    354272}
Note: See TracChangeset for help on using the changeset viewer.