Changeset 9854278


Ignore:
Timestamp:
Dec 23, 2003, 3:22:21 AM (20 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e9f239b
Parents:
952bb256
Message:
First pass at AIM away messages.  It is a little different from
  what most clients seem to do, in that an away reply is sent for
  each message received.  Most clients only reply to the first one
  per away-session.  Also, it's completely tied to the zaway
  functions, it should probably be separated out into aaway
  functions with a new "away" function that will get everything.
  Loop detection stuff should work and has been tested, but I'm
  not completely sure I did this right ... so odd behavior should
  be reported.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r952bb256 r9854278  
    55          dangerous, should switch to an admin msg for results, or add a
    66          new event queue
    7        
     7        First pass at AIM away messages.  It is a little different from
     8          what most clients seem to do, in that an away reply is sent for
     9          each message received.  Most clients only reply to the first one
     10          per away-session.  Also, it's completely tied to the zaway
     11          functions, it should probably be separated out into aaway
     12          functions with a new "away" function that will get everything.
     13          Loop detection stuff should work and has been tested, but I'm
     14          not completely sure I did this right ... so odd behavior should
     15          be reported.
     16       
    8172.1.1-pre-1
    918        Only print forced AIM logout message once.
  • aim.c

    r952bb256 r9854278  
    254254  ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, NULL, msg);
    255255   
    256   /* aim_send_im(owl_global_get_aimsess(&g), to, AIM_IMFLAGS_ACK, msg); */
     256  /* I don't know how to check for an error yet */
     257  return(ret);
     258}
     259
     260int owl_aim_send_awaymsg(char *to, char *msg)
     261{
     262  int ret;
     263
     264  ret=aim_im_sendch1(owl_global_get_aimsess(&g), to, AIM_IMFLAGS_AWAY, msg);
    257265
    258266  /* I don't know how to check for an error yet */
     
    295303int owl_aim_set_awaymsg(char *msg)
    296304{
     305  int len;
     306  char *foo;
    297307  /* there is a max away message lentgh we should check against */
     308
     309  foo=owl_strdup(msg);
     310  len=strlen(foo);
     311  if (len>500) {
     312    foo[500]='\0';
     313    len=499;
     314  }
     315   
     316  aim_locate_setprofile(owl_global_get_aimsess(&g),
     317                        NULL, NULL, 0,
     318                        "us-ascii", foo, len);
     319  owl_free(foo);
    298320
    299321  /*
     
    332354    od->create_rooms = g_slist_append(od->create_rooms, cr);
    333355    */
    334     /* aim_reqservice(owl_global_get_aimsess(&g), owl_global_get_bosconn(&g), AIM_CONN_TYPE_CHATNAV); */
     356    aim_reqservice(owl_global_get_aimsess(&g),
     357                   aim_getconn_type(owl_global_get_aimsess(&g), AIM_CONN_TYPE_CHATNAV),
     358                   AIM_CONN_TYPE_CHATNAV);
    335359    aim_reqservice(owl_global_get_aimsess(&g), NULL, AIM_CONN_TYPE_CHATNAV);
    336360    aim_chatnav_createroom(owl_global_get_aimsess(&g), cur, name, exchange);
     
    14431467                         OWL_MESSAGE_DIRECTION_IN,
    14441468                         0);
     1469  if (args->icbmflags & AIM_IMFLAGS_AWAY) owl_message_set_attribute(m, "isauto", "");
    14451470  owl_global_messagequeue_addmsg(&g, m);
    14461471  owl_free(stripmsg);
  • functions.c

    r952bb256 r9854278  
    443443  if (!ret) {
    444444    owl_function_makemsg("AIM message sent.");
     445  } else {
     446    owl_function_error("Could not send AIM message.");
     447  }
     448
     449  /* display the message as an outgoing message in the receive window */
     450  if (owl_global_is_displayoutgoing(&g)) {
     451    owl_function_make_outgoing_aim(msg, to);
     452  }
     453
     454  /* log it if we have logging turned on */
     455  if (owl_global_is_logging(&g)) {
     456    owl_log_outgoing_aim(to, msg);
     457  }
     458
     459  owl_free(format_msg);
     460}
     461
     462void owl_function_send_aimawymsg(char *to, char *msg)
     463{
     464  int ret;
     465  char *format_msg;
     466
     467  /* make a formatted copy of the message */
     468  format_msg=owl_strdup(msg);
     469  owl_text_wordunwrap(format_msg);
     470 
     471  /* send the message */
     472  ret=owl_aim_send_awaymsg(to, format_msg);
     473  if (!ret) {
     474    /* owl_function_makemsg("AIM message sent."); */
    445475  } else {
    446476    owl_function_error("Could not send AIM message.");
     
    834864  owl_global_set_zaway_on(&g);
    835865  owl_aim_set_awaymsg(owl_global_get_zaway_msg(&g));
    836   owl_function_makemsg("zaway set (%s)", owl_global_get_zaway_msg(&g));
     866  owl_function_makemsg("aim and zaway set (%s)", owl_global_get_zaway_msg(&g));
    837867}
    838868
     
    840870{
    841871  owl_global_set_zaway_off(&g);
    842   owl_function_makemsg("zaway off");
     872  owl_aim_set_awaymsg("");
     873  owl_function_makemsg("aim and zaway off");
    843874}
    844875
  • message.c

    r2de4f20 r9854278  
    771771
    772772 
    773   /* is the "isprivate" attribute if it's a private zephyr */
     773  /* set the "isprivate" attribute if it's a private zephyr */
    774774  if (!strcasecmp(n->z_recipient, owl_zephyr_get_sender())) {
    775775    owl_message_set_isprivate(m);
     776  }
     777
     778  /* set the "isauto" attribute if it's an autoreply */
     779  if (!strcasecmp(n->z_message, "Automated reply:") ||
     780      !strcasecmp(n->z_opcode, "auto")) {
     781    owl_message_set_attribute(m, "isauto", "");
    776782  }
    777783
  • owl.c

    r5a95b69 r9854278  
    472472
    473473      /* do we need to autoreply? */
    474       if (owl_global_is_zaway(&g)) {
     474      if (owl_global_is_zaway(&g) && !owl_message_get_attribute_value(m, "isauto")) {
    475475        if (owl_message_is_type_zephyr(m)) {
    476476          owl_zephyr_zaway(m);
    477477        } else if (owl_message_is_type_aim(m)) {
    478           /* can't do this, there's no mechanism not to start a loop */
    479           /* owl_aim_send_im(owl_message_get_sender(m), owl_global_get_zaway_msg(&g)); */
     478          owl_function_send_aimawymsg(owl_message_get_sender(m), owl_global_get_zaway_msg(&g));
    480479        }
    481480      }
  • zephyr.c

    r2de4f20 r9854278  
    484484  if (!strcasecmp(owl_message_get_zsig(m), "Automated reply:")) return;
    485485  if (!strcasecmp(owl_message_get_sender(m), ZGetSender())) return;
     486  if (owl_message_get_attribute_value(m, "isauto")) return;
    486487
    487488  if (owl_global_is_smartstrip(&g)) {
Note: See TracChangeset for help on using the changeset viewer.