Changes in protocols/nogaim.c [a6b2f13:839189b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
ra6b2f13 r839189b 657 657 u->away = u->status_msg = NULL; 658 658 659 if( ( flags & OPT_LOGGED_IN ) && !u->online ) 660 { 659 if( set_getbool( &ic->irc->set, "show_offline" ) && !u->online ) 660 { 661 /* always set users as online */ 661 662 irc_spawn( ic->irc, u ); 662 663 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; 663 674 } 664 675 else if( !( flags & OPT_LOGGED_IN ) && u->online ) … … 666 677 struct groupchat *c; 667 678 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 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 } 690 } 691 else 692 { 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 676 703 if( flags & OPT_AWAY ) 677 704 { … … 698 725 } 699 726 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 */ 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" ) ) 704 729 { 705 730 char *from; … … 714 739 ic->irc->myhost ); 715 740 } 716 if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) { 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 } 717 774 irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel, 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 ); 775 u->away?'-':'+', u->nick ); 776 g_free( from ); 777 } 729 778 } 730 779 } … … 735 784 char *wrapped, *ts = NULL; 736 785 user_t *u; 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 786 745 787 u = user_findhandle( ic, handle ); 788 746 789 if( !u ) 747 790 { … … 753 796 imcb_log( ic, "Ignoring message from unknown handle %s", handle ); 754 797 755 g_free(msg);756 798 return; 757 799 } … … 787 829 { 788 830 char *new = g_strconcat( ts, msg, NULL ); 789 g_free( msg);790 msg = new;831 g_free( ts ); 832 ts = msg = new; 791 833 } 792 834 … … 794 836 irc_msgfrom( irc, u->nick, wrapped ); 795 837 g_free( wrapped ); 796 g_free( msg );797 838 g_free( ts ); 798 839 } … … 1071 1112 /* Misc. BitlBee stuff which shouldn't really be here */ 1072 1113 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 else 1137 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 1073 1169 char *set_eval_timezone( set_t *set, char *value ) 1074 1170 { … … 1156 1252 return g_strdup_printf( "\x02[\x02\x02\x02%04d-%02d-%02d " 1157 1253 "%02d:%02d:%02d\x02]\x02 ", 1158 msg.tm_year + 1900, msg.tm_mon , msg.tm_mday,1254 msg.tm_year + 1900, msg.tm_mon + 1, msg.tm_mday, 1159 1255 msg.tm_hour, msg.tm_min, msg.tm_sec ); 1160 1256 } … … 1173 1269 msg = buf; 1174 1270 } 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); 1271 1272 st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags ); 1273 g_free( buf ); 1274 1180 1275 return st; 1181 1276 }
Note: See TracChangeset
for help on using the changeset viewer.