Changes in protocols/nogaim.c [839189b:a6b2f13]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r839189b ra6b2f13 657 657 u->away = u->status_msg = NULL; 658 658 659 if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online ) 660 { 661 /* always set users as online */ 659 if( ( flags & OPT_LOGGED_IN ) && !u->online ) 660 { 662 661 irc_spawn( ic->irc, u ); 663 662 u->online = 1; 664 if( !( flags & OPT_LOGGED_IN ) )665 {666 /* set away message if user isn't really online */667 u->away = g_strdup( "User is offline" );668 }669 }670 else if( ( flags & OPT_LOGGED_IN ) && !u->online )671 {672 irc_spawn( ic->irc, u );673 u->online = 1;674 663 } 675 664 else if( !( flags & OPT_LOGGED_IN ) && u->online ) … … 677 666 struct groupchat *c; 678 667 679 if( set_getbool( &ic->irc->set, "show_offline" ) ) 680 { 681 /* keep offline users in channel and set away message to "offline" */ 682 u->away = g_strdup( "User is offline" ); 683 684 /* Keep showing him/her in the control channel but not in groupchats. */ 685 for( c = ic->groupchats; c; c = c->next ) 686 { 687 if( remove_chat_buddy_silent( c, handle ) && c->joined ) 688 irc_part( c->ic->irc, u, c->channel ); 689 } 668 irc_kill( ic->irc, u ); 669 u->online = 0; 670 671 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */ 672 for( c = ic->groupchats; c; c = c->next ) 673 remove_chat_buddy_silent( c, handle ); 674 } 675 676 if( flags & OPT_AWAY ) 677 { 678 if( state && message ) 679 { 680 u->away = g_strdup_printf( "%s (%s)", state, message ); 681 } 682 else if( state ) 683 { 684 u->away = g_strdup( state ); 685 } 686 else if( message ) 687 { 688 u->away = g_strdup( message ); 690 689 } 691 690 else 692 691 { 693 /* kill offline users */694 irc_kill( ic->irc, u );695 u->online = 0;696 697 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */698 for( c = ic->groupchats; c; c = c->next )699 remove_chat_buddy_silent( c, handle );700 }701 }702 703 if( flags & OPT_AWAY )704 {705 if( state && message )706 {707 u->away = g_strdup_printf( "%s (%s)", state, message );708 }709 else if( state )710 {711 u->away = g_strdup( state );712 }713 else if( message )714 {715 u->away = g_strdup( message );716 }717 else718 {719 692 u->away = g_strdup( "Away" ); 720 693 } … … 725 698 } 726 699 727 /* early if-clause for show_offline even if there is some redundant code here because this isn't LISP but C ;) */ 728 if( set_getbool( &ic->irc->set, "show_offline" ) && set_getbool( &ic->irc->set, "away_devoice" ) ) 700 /* LISPy... */ 701 if( ( u->online ) && /* Don't touch offline people */ 702 ( ( ( u->online != oo ) && !u->away ) || /* Do joining people */ 703 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* Do people changing state */ 729 704 { 730 705 char *from; … … 739 714 ic->irc->myhost ); 740 715 } 741 742 /* if we use show_offline, we op online users, voice away users, and devoice/deop offline users */ 743 if( flags & OPT_LOGGED_IN ) 744 { 745 /* user is "online" (either really online or away) */ 746 irc_write( ic->irc, ":%s MODE %s %cv%co %s %s", from, ic->irc->channel, 747 u->away?'+':'-', u->away?'-':'+', u->nick, u->nick ); 748 } 749 else 750 { 751 /* user is offline */ 752 irc_write( ic->irc, ":%s MODE %s -vo %s %s", from, ic->irc->channel, u->nick, u->nick ); 753 } 754 } 755 else 756 { 757 /* LISPy... */ 758 if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 759 ( u->online ) && /* Don't touch offline people */ 760 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ 761 ( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */ 762 { 763 char *from; 764 765 if( set_getbool( &ic->irc->set, "simulate_netsplit" ) ) 766 { 767 from = g_strdup( ic->irc->myhost ); 768 } 769 else 770 { 771 from = g_strdup_printf( "%s!%s@%s", ic->irc->mynick, ic->irc->mynick, 772 ic->irc->myhost ); 773 } 716 if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) { 774 717 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 775 u->away?'-':'+', u->nick ); 776 g_free( from ); 777 } 718 u->away?'-':'+', u->nick ); 719 } 720 if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "notaway")) { 721 irc_write( ic->irc, ":%s MODE %s %ch %s", from, ic->irc->channel, 722 u->away?'-':'+', u->nick ); 723 } 724 if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "notaway")) { 725 irc_write( ic->irc, ":%s MODE %s %co %s", from, ic->irc->channel, 726 u->away?'-':'+', u->nick ); 727 } 728 g_free( from ); 778 729 } 779 730 } … … 784 735 char *wrapped, *ts = NULL; 785 736 user_t *u; 786 737 738 /* pass the message through OTR */ 739 msg = otr_handle_message(ic, handle, msg); 740 if(!msg) { 741 /* this was an internal OTR protocol message */ 742 return; 743 } 744 787 745 u = user_findhandle( ic, handle ); 788 789 746 if( !u ) 790 747 { … … 796 753 imcb_log( ic, "Ignoring message from unknown handle %s", handle ); 797 754 755 g_free(msg); 798 756 return; 799 757 } … … 829 787 { 830 788 char *new = g_strconcat( ts, msg, NULL ); 831 g_free( ts);832 ts =msg = new;789 g_free( msg ); 790 msg = new; 833 791 } 834 792 … … 836 794 irc_msgfrom( irc, u->nick, wrapped ); 837 795 g_free( wrapped ); 796 g_free( msg ); 838 797 g_free( ts ); 839 798 } … … 1112 1071 /* Misc. BitlBee stuff which shouldn't really be here */ 1113 1072 1114 char *set_eval_away_devoice( set_t *set, char *value )1115 {1116 irc_t *irc = set->data;1117 int st;1118 1119 if( !is_bool( value ) )1120 return SET_INVALID;1121 1122 st = bool2int( value );1123 1124 /* Horror.... */1125 1126 if( st != set_getbool( &irc->set, "away_devoice" ) )1127 {1128 char list[80] = "";1129 user_t *u = irc->users;1130 int i = 0, count = 0;1131 char pm;1132 char v[80];1133 1134 if( st )1135 pm = '+';1136 else1137 pm = '-';1138 1139 while( u )1140 {1141 if( u->ic && u->online && !u->away )1142 {1143 if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )1144 {1145 for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;1146 irc_write( irc, ":%s MODE %s %c%s%s",1147 irc->myhost,1148 irc->channel, pm, v, list );1149 1150 *list = 0;1151 count = 0;1152 }1153 1154 sprintf( list + strlen( list ), " %s", u->nick );1155 count ++;1156 }1157 u = u->next;1158 }1159 1160 /* $v = 'v' x $i */1161 for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;1162 irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost,1163 irc->channel, pm, v, list );1164 }1165 1166 return value;1167 }1168 1169 1073 char *set_eval_timezone( set_t *set, char *value ) 1170 1074 { … … 1252 1156 return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d " 1253 1157 "%02d:%02d:%02d\x02]\x02 ", 1254 msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday,1158 msg.tm_year + 1900, msg.tm_mon, msg.tm_mday, 1255 1159 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1256 1160 } … … 1269 1173 msg = buf; 1270 1174 } 1271 1272 st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags ); 1273 g_free( buf ); 1274 1175 1176 /* if compiled without otr support, this just calls the prpl buddy_msg */ 1177 st = otr_send_message(ic, handle, msg, flags); 1178 1179 g_free(buf); 1275 1180 return st; 1276 1181 }
Note: See TracChangeset
for help on using the changeset viewer.