Changeset 6e9ae72
- Timestamp:
- 2011-12-17T13:50:01Z (13 years ago)
- Branches:
- master
- Children:
- 18c6d36
- Parents:
- 87dddee (diff), 17f057d (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. - Files:
-
- 25 added
- 51 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r87dddee r6e9ae72 27 27 subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) 28 28 29 all: $(OUTFILE) $(OTR_PI) systemd29 all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) systemd 30 30 $(MAKE) -C doc 31 ifdef SKYPE_PI 32 $(MAKE) -C protocols/skype doc 33 endif 31 34 32 35 uninstall: uninstall-bin uninstall-doc … … 71 74 install-doc: 72 75 $(MAKE) -C doc install 76 ifdef SKYPE_PI 77 $(MAKE) -C protocols/skype install-doc 78 endif 73 79 74 80 uninstall-doc: 75 81 $(MAKE) -C doc uninstall 82 ifdef SKYPE_PI 83 $(MAKE) -C protocols/skype uninstall-doc 84 endif 76 85 77 86 install-bin: 78 mkdir -p $(DESTDIR)$( BINDIR)79 install -m 0755 $(OUTFILE) $(DESTDIR)$( BINDIR)/$(OUTFILE)87 mkdir -p $(DESTDIR)$(SBINDIR) 88 install -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) 80 89 81 90 uninstall-bin: 82 rm -f $(DESTDIR)$( BINDIR)/$(OUTFILE)91 rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) 83 92 84 93 install-dev: … … 104 113 -rmdir $(DESTDIR)$(ETCDIR) 105 114 106 install-plugins: 115 install-plugins: install-plugin-otr install-plugin-skype 116 117 install-plugin-otr: 107 118 ifdef OTR_PI 108 119 mkdir -p $(DESTDIR)$(PLUGINDIR) 109 120 install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) 121 endif 122 123 install-plugin-skype: 124 ifdef SKYPE_PI 125 mkdir -p $(DESTDIR)$(PLUGINDIR) 126 install -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) 127 mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) 128 install -m 0644 $(SRCDIR)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf 129 install -m 0644 $(SRCDIR)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf 130 install -m 0755 $(SRCDIR)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped 131 make -C protocols/skype install-doc 110 132 endif 111 133 … … 139 161 $(OTR_PI): %.so: $(SRCDIR)%.c 140 162 @echo '*' Building plugin $@ 141 @$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ 163 @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS) 164 165 $(SKYPE_PI): $(SRCDIR)protocols/skype/skype.c 166 @echo '*' Building plugin skype 167 @$(CC) $(CFLAGS) -fPIC -shared $< -o $@ 142 168 143 169 $(objects): %.o: $(SRCDIR)%.c … … 164 190 165 191 -include .depend/*.d 192 # DO NOT DELETE -
bitlbee.h
r87dddee r6e9ae72 35 35 36 36 #define PACKAGE "BitlBee" 37 #define BITLBEE_VERSION "3.0. 3"37 #define BITLBEE_VERSION "3.0.4" 38 38 #define VERSION BITLBEE_VERSION 39 39 #define BITLBEE_VER(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 40 #define BITLBEE_VERSION_CODE BITLBEE_VER(3, 0, 3)40 #define BITLBEE_VERSION_CODE BITLBEE_VER(3, 0, 4) 41 41 42 42 #define MAX_STRING 511 -
configure
r87dddee r6e9ae72 9 9 10 10 prefix='/usr/local/' 11 bindir='$prefix/sbin/' 11 bindir='$prefix/bin/' 12 sbindir='$prefix/sbin/' 12 13 etcdir='$prefix/etc/bitlbee/' 13 14 mandir='$prefix/share/man/' … … 19 20 libevent='/usr/' 20 21 pidfile='/var/run/bitlbee.pid' 21 ipcsocket=' /var/run/bitlbee.sock'22 ipcsocket='' 22 23 pcdir='$prefix/lib/pkgconfig' 23 24 systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" … … 28 29 yahoo=1 29 30 twitter=1 30 twitter=131 31 purple=0 32 32 … … 36 36 plugins=1 37 37 otr=0 38 skype=0 38 39 39 40 events=glib … … 59 60 --prefix=... Directories to put files in $prefix 60 61 --bindir=... $bindir 62 --sbindir=... $sbindir 61 63 --etcdir=... $etcdir 62 64 --mandir=... $mandir … … 66 68 --pidfile=... $pidfile 67 69 --config=... $config 68 --ipcsocket=... $ipcsocket69 70 70 71 --msn=0/1 Disable/enable MSN part $msn … … 83 84 --otr=0/1/auto/plugin 84 85 Disable/enable OTR encryption support $otr 86 --skype=0/1/plugin 87 Disable/enable Skype support $skype 85 88 86 89 --events=... Event handler (glib, libevent) $events … … 98 101 # Expand $prefix and get rid of double slashes 99 102 bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'` 103 sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'` 100 104 etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'` 101 105 mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'` … … 110 114 pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'` 111 115 116 protocols_mods="" 117 112 118 cat<<EOF>Makefile.settings 113 119 ## BitlBee settings, generated by configure 114 120 PREFIX=$prefix 115 121 BINDIR=$bindir 122 SBINDIR=$sbindir 116 123 ETCDIR=$etcdir 117 124 MANDIR=$mandir … … 323 330 324 331 RESOLV_TESTCODE=' 332 #include <sys/types.h> 333 #include <netinet/in.h> 325 334 #include <arpa/nameser.h> 326 335 #include <resolv.h> … … 335 344 detect_resolv_dynamic() 336 345 { 346 case "$arch" in 347 FreeBSD ) 348 # In FreeBSD res_* routines are present in libc.so 349 LIBRESOLV=;; 350 * ) 351 LIBRESOLV=-lresolv;; 352 esac 337 353 TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) 338 354 ret=1 339 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv>/dev/null 2>/dev/null355 echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null 340 356 if [ "$?" = "0" ]; then 341 echo 'EFLAGS+=-lresolv'>> Makefile.settings357 echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings 342 358 ret=0 343 359 fi … … 538 554 fi 539 555 556 if [ "$skype" = "1" -o "$skype" = "plugin" ]; then 557 echo 'SKYPE_PI=skype.so' >> Makefile.settings 558 protocols_mods="$protocol_mods skype(plugin)" 559 fi 560 540 561 if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then 541 562 echo … … 751 772 752 773 if [ -n "$protocols" ]; then 753 echo ' Building with these protocols:' $protocols 774 echo ' Building with these protocols:' $protocols$protocols_mods 754 775 case "$protocols" in 755 776 *purple*) -
debian/changelog
r87dddee r6e9ae72 1 bitlbee (3.0.4-1) unstable; urgency=low 2 3 * New upstream release. 4 * Added bitlbee-plugin-skype and skyped packages, now part of BitlBee 5 instead of a separate package. 6 * Fixed dependencies of bitlbee-plugin-otr package to not break with 7 binary MTUs. (Closes: #651612) 8 * ^B and some other things are stripped in outgoing XMPP stanzas. 9 (Closes: #507856) 10 * OTR module linking fix. Not with the fix from the Debian bug but with 11 one from bugs.bitlbee.org. I hope that covers it. (Closes: #646369) 12 * Closing a few old bugs that were filed against the Debian package 13 instead of upstream: 14 - Joining password-protected MUCs is working for a while already, set 15 the password using "chan set". (Closes: #615624) 16 - "Headline:" msgs (Closes: #605459) 17 - Yahoo! was fixed long ago and Etch is deprecated. (Closes: #476529) 18 - identi.ca support is documented. (Closes: #613789) 19 20 -- Wilmer van der Gaast <wilmer@gaast.net> Sun, 11 Dec 2011 16:53:31 +0000 21 1 22 bitlbee (3.0.3-1) unstable; urgency=low 2 23 -
debian/control
r87dddee r6e9ae72 5 5 Uploaders: Jelmer Vernooij <jelmer@samba.org> 6 6 Standards-Version: 3.9.1 7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), po-debconf, libpurple-dev, libotr2-dev, debhelper (>= 6.0.7~) 7 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), po-debconf, libpurple-dev, libotr2-dev, debhelper (>= 6.0.7~), asciidoc 8 8 Homepage: http://www.bitlbee.org/ 9 9 Vcs-Bzr: http://code.bitlbee.org/bitlbee/ … … 61 61 Package: bitlbee-plugin-otr 62 62 Architecture: any 63 Depends: ${misc:Depends}, ${shlibs:Depends}, bitlbee ( = ${bee:Version}) | bitlbee-libpurple (= ${bee:Version}), bitlbee-common (= ${bee:Version})63 Depends: ${misc:Depends}, ${shlibs:Depends}, bitlbee (>= ${bee:Version}) | bitlbee-libpurple (>= ${bee:Version}), bitlbee (<< ${bee:Version}.1~) | bitlbee-libpurple (<< ${bee:Version}.1~), bitlbee-common (= ${bee:Version}) 64 64 Description: An IRC to other chat networks gateway (OTR plugin) 65 65 This program can be used as an IRC server which forwards everything you … … 69 69 This package contains a plugin that adds support for Off-The-Record 70 70 encryption of instant messages. 71 72 Package: bitlbee-plugin-skype 73 Architecture: any 74 Depends: ${shlibs:Depends}, ${misc:Depends}, bitlbee (>= ${bee:Version}) | bitlbee-libpurple (>= ${bee:Version}), bitlbee (<< ${bee:Version}.1~) | bitlbee-libpurple (<< ${bee:Version}.1~) 75 Recommends: skyped 76 Description: An IRC to other chat networks gateway (Skype plugin) 77 This program can be used as an IRC server which forwards everything you 78 say to people on other chat networks: Jabber (which includes Google Talk 79 and Facebook Chat), ICQ, AIM, MSN, Yahoo! and Twitter/Identica/Status.net. 80 . 81 This package contains a plugin that adds support for the Skype IM network. 82 You need to download and install the Skype client for this to work. 83 84 Package: skyped 85 Architecture: any 86 Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.5), python-gnutls, python-skype (>=0.9.28.7) 87 Recommends: skype 88 Description: Daemon to control Skype remotely 89 Daemon to control the GUI Skype client. Currently required to control Skype 90 from the BitlBee IRC2IM gateway. Skyped and Skype can run on a different 91 host than the BitlBee server, the communication is encrypted. 92 . 93 You need to download and install the Skype client for this to work. -
debian/rules
r87dddee r6e9ae72 11 11 BITLBEE_LIBPURPLE ?= 1 12 12 BITLBEE_OTR ?= plugin 13 BITLBEE_SKYPE ?= plugin 13 14 BITLBEE_CONFIGURE_FLAGS ?= 14 15 DEBUG ?= 0 … … 27 28 endif 28 29 30 ifneq ($(BITLBEE_SKYPE),plugin) 31 DH_OPTIONS += -Nbitlbee-plugin-skype -Nskyped 32 endif 33 29 34 build: build-stamp 30 35 build-stamp: … … 32 37 33 38 mkdir -p debian/build-native 34 ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=$(BITLBEE_OTR) $(BITLBEE_CONFIGURE_FLAGS)39 ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=$(BITLBEE_OTR) --skype=$(BITLBEE_SKYPE) $(BITLBEE_CONFIGURE_FLAGS) 35 40 $(MAKE) -C debian/build-native 36 41 … … 64 69 $(MAKE) -C debian/build-native install-etc install-doc DESTDIR=`pwd`/debian/bitlbee-common 65 70 $(MAKE) -C debian/build-native install-dev DESTDIR=`pwd`/debian/bitlbee-dev 66 $(MAKE) -C debian/build-native install-plugins DESTDIR=`pwd`/debian/bitlbee-plugin-otr 71 $(MAKE) -C debian/build-native install-plugin-otr DESTDIR=`pwd`/debian/bitlbee-plugin-otr 72 $(MAKE) -C debian/build-native install-plugin-skype DESTDIR=`pwd`/debian/skyped 73 74 mkdir -p debian/bitlbee-plugin-skype/usr 75 mv debian/skyped/usr/lib debian/bitlbee-plugin-skype/usr 76 77 mkdir -p debian/skyped/usr/share/man/man1 78 mv debian/bitlbee-common/usr/share/man/man1/skyped* debian/skyped/usr/share/man/man1 67 79 68 80 ifeq ($(BITLBEE_LIBPURPLE),1) -
doc/CHANGES
r87dddee r6e9ae72 3 3 4 4 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on 5 6 Version 3.0.4: 7 - Merged Skype support. This used to be a separate plugin, and it still is, 8 but by including it with BitlBee by default it will be easier to keep it 9 in sync with changes to BitlBee. 10 - Fixed a file descriptor leak bug that may have caused strange behaviour 11 in BitlBee sessions running for a long time. 12 - Now fetches Twitter mentions as well if the "fetch_mentions" account 13 setting is enabled. 14 - With t.co now all over Twitter, show the original (but truncated) URL 15 between <brackets>. 16 - Fixed MSN Messenger login issues ("timeout" while fetching buddy list). 17 - Another (related) GnuTLS compatibility fix (now 2.13+?). 18 19 Finished 4 Dec 2011 (Exactly 6 years since 1.0!) 5 20 6 21 Version 3.0.3: -
doc/user-guide/commands.xml
r87dddee r6e9ae72 852 852 853 853 <variablelist> 854 <varlistentry><term>undo [<id>]</term><listitem><para>Delete your last Tweet (or one with the given ID)</para></listitem></varlistentry>855 <varlistentry><term>rt <screenname| id></term><listitem><para>Retweet someone's last Tweet (or one with the given ID)</para></listitem></varlistentry>856 <varlistentry><term>reply <screenname| id></term><listitem><para>Reply to a Tweet (with a reply-to reference)</para></listitem></varlistentry>854 <varlistentry><term>undo #[<id>]</term><listitem><para>Delete your last Tweet (or one with the given ID)</para></listitem></varlistentry> 855 <varlistentry><term>rt <screenname|#id></term><listitem><para>Retweet someone's last Tweet (or one with the given ID)</para></listitem></varlistentry> 856 <varlistentry><term>reply <screenname|#id></term><listitem><para>Reply to a Tweet (with a reply-to reference)</para></listitem></varlistentry> 857 857 <varlistentry><term>follow <screenname></term><listitem><para>Start following a person</para></listitem></varlistentry> 858 858 <varlistentry><term>unfollow <screenname></term><listitem><para>Stop following a person</para></listitem></varlistentry> -
doc/user-guide/help.xsl
r87dddee r6e9ae72 73 73 74 74 <xsl:template match="command-list"> 75 <xsl:text>These are all root commands. See _b_help <command name>_b_ for more details on each command. </xsl:text> 75 76 <xsl:for-each select="../bitlbee-command"> 76 77 <xsl:text> * _b_</xsl:text><xsl:value-of select="@name"/><xsl:text>_b_ - </xsl:text><xsl:value-of select="short-description"/><xsl:text> </xsl:text> 77 78 </xsl:for-each> 79 <xsl:text> Most commands can be shortened. For example instead of _b_account list_b_, try _b_ac l_b_. </xsl:text> 78 80 <xsl:text> </xsl:text> 79 81 </xsl:template> -
doc/user-guide/misc.xml
r87dddee r6e9ae72 191 191 192 192 <ircexample> 193 <ircline nick="wilmer">chan set &wlmfill_by account</ircline>193 <ircline nick="wilmer">chan &wlm set fill_by account</ircline> 194 194 <ircline nick="root">fill_by = `account'</ircline> 195 <ircline nick="wilmer">chan set &wlmaccount msn</ircline>195 <ircline nick="wilmer">chan &wlm set account msn</ircline> 196 196 <ircline nick="root">account = `msn'</ircline> 197 197 </ircexample> … … 204 204 205 205 <ircexample> 206 <ircline nick="wilmer">chan set &offlineshow_users offline</ircline>206 <ircline nick="wilmer">chan &offline set show_users offline</ircline> 207 207 <ircline nick="root">show_users = `offline'</ircline> 208 208 </ircexample> -
doc/user-guide/quickstart.xml
r87dddee r6e9ae72 53 53 54 54 <sect1 id="quickstart3"> 55 <title>Managing Contact Lists: Rename</title> 56 57 <!--quickstart3--> 58 <para> 59 <emphasis>Step Three: Managing Contact Lists: Rename</emphasis> 60 </para> 61 62 <para> 63 Now BitlBee logs in and downloads the contact list from the IM server. In a few seconds, all your on-line buddies should show up in the control channel. 64 </para> 65 66 <para> 67 BitlBee will convert names into IRC-friendly form (for instance: tux@example.com will be given the nickname tux). If you have more than one person who would have the same name by this logic (for instance: tux@example.com and tux@bitlbee.org) the second one to log on will be tux_. The same is true if you have a tux log on to AOL and a tux log on from Yahoo. 68 </para> 69 70 <para> 71 It would be easy to get these two mixed up, so BitlBee has a <emphasis>rename</emphasis> command to change the nickname into something more suitable: <emphasis>rename <oldnick> <newnick></emphasis> 72 </para> 73 74 <ircexample> 75 <ircline nick="you">rename tux_ bitlbeetux</ircline> 76 <ircaction nick="tux_">is now known as <emphasis>bitlbeetux</emphasis></ircaction> 77 <ircline nick="root">Nick successfully changed</ircline> 78 </ircexample> 79 80 <para> 81 When finished, type <emphasis>help quickstart4</emphasis> to continue. 82 </para> 83 84 </sect1> 85 86 <sect1 id="quickstart4"> 87 <title>Step Four: Managing Contact Lists: Add and Remove.</title> 88 89 <para> 90 <emphasis>Step Four: Managing Contact Lists: Add and Remove.</emphasis> 91 </para> 55 <title>Step Four: Managing Contact Lists: Add, Remove and Rename</title> 92 56 93 57 <para> … … 105 69 106 70 <para> 107 Lets say you accidentally added r2d3@example.com rather than r2d2@example.com, or maybe you just want to remove a user from your list because you never talk to them. To remove a name you will want to use the <emphasis>remove</emphasis> command: <emphasis>remove <nick></emphasis>71 Lets say you accidentally added r2d3@example.com rather than r2d2@example.com, or maybe you just want to remove a user from your list because you never talk to them. To remove a name you will want to use the <emphasis>remove</emphasis> command: <emphasis>remove r2d3</emphasis> 108 72 </para> 109 73 110 74 <para> 111 When finished, type <emphasis>help quickstart5</emphasis> to continue. 75 Finally, if you have multiple users with similar names you may use the <emphasis>rename</emphasis> command to make it easier to remember: <emphasis>rename r2d2_ r2d2_aim</emphasis> 76 </para> 77 78 <para> 79 When finished, type <emphasis>help quickstart4</emphasis> to continue. 112 80 </para> 113 81 114 82 </sect1> 115 83 116 <sect1 id="quickstart 5">84 <sect1 id="quickstart4"> 117 85 <title>Chatting</title> 118 86 … … 139 107 140 108 <para> 141 You know the basics. If you want to get to know more about BitlBee, please type <emphasis>help quickstart6</emphasis>.109 You know the basics. If you want to know about some of the neat features BitlBee offers, please type <emphasis>help quickstart5</emphasis>. 142 110 </para> 143 111 144 112 </sect1> 145 113 146 <sect1 id="quickstart 6">114 <sect1 id="quickstart5"> 147 115 <title>Further Resources</title> 148 116 149 117 <para> 150 <emphasis>So you want more than just chatting? Or maybe you're just looking for a feature?</emphasis> 118 <emphasis>So you want more than just chatting? Or maybe you're just looking for more features?</emphasis> 119 </para> 120 121 <para> 122 With multiple channel support you can have contacts for specific protocols in their own channels, for instance, if you <emphasis>/join &msn</emphasis> you will join a channel that only contains your MSN contacts. 123 </para> 124 125 <para> 126 Account tagging allows you to use the given account name rather than a number when referencing your account. If you wish to turn off your gtalk account, you may <emphasis>account gtalk off</emphasis> rather than <emphasis>account 3 off</emphasis> where "3" is the account number. 151 127 </para> 152 128 -
ipc.c
r87dddee r6e9ae72 356 356 irc_switch_fd( irc, ipc_child_recv_fd ); 357 357 irc_sync( irc ); 358 irc_ usermsg( irc, "You've successfully taken over your old session" );358 irc_rootmsg( irc, "You've successfully taken over your old session" ); 359 359 ipc_child_recv_fd = -1; 360 360 … … 374 374 { 375 375 /* Master->New connection */ 376 irc_ usermsg( irc, "Could not take over old session" );376 irc_rootmsg( irc, "Could not take over old session" ); 377 377 } 378 378 } … … 412 412 /* Drop credentials, we'll shut down soon and shouldn't overwrite 413 413 any settings. */ 414 irc_ usermsg( irc, "Trying to take over existing session" );414 irc_rootmsg( irc, "Trying to take over existing session" ); 415 415 416 416 irc_desync( irc ); … … 909 909 int serversock; 910 910 911 if (!IPCSOCKET || !*IPCSOCKET) 912 return 1; 913 911 914 /* Clean up old socket files that were hanging around.. */ 912 915 if (unlink(IPCSOCKET) == -1 && errno != ENOENT) { -
irc.c
r87dddee r6e9ae72 363 363 if( irc->status & USTATUS_LOGGED_IN ) 364 364 { 365 irc_ usermsg( irc, "Error: Charset mismatch detected. The charset "365 irc_rootmsg( irc, "Error: Charset mismatch detected. The charset " 366 366 "setting is currently set to %s, so please make " 367 367 "sure your IRC client will send and accept text in " … … 767 767 irc->root->last_channel = irc->default_channel; 768 768 769 irc_ usermsg( irc,769 irc_rootmsg( irc, 770 770 "Welcome to the BitlBee gateway!\n\n" 771 771 "If you've never used BitlBee before, please do read the help " … … 910 910 g_free( test ); 911 911 g_iconv_close( oc ); 912 irc_ usermsg( irc, "Unsupported character set: The IRC protocol "912 irc_rootmsg( irc, "Unsupported character set: The IRC protocol " 913 913 "only supports 8-bit character sets." ); 914 914 return NULL; … … 941 941 GSList *l; 942 942 943 irc_ usermsg( irc, "Setting `%s' is obsolete, use the `show_users' "943 irc_rootmsg( irc, "Setting `%s' is obsolete, use the `show_users' " 944 944 "channel setting instead.", set->key ); 945 945 -
irc.h
r87dddee r6e9ae72 317 317 void irc_send_login( irc_t *irc ); 318 318 void irc_send_motd( irc_t *irc ); 319 void irc_usermsg( irc_t *irc, char *format, ... ); 319 const char *irc_user_msgdest( irc_user_t *iu ); 320 void irc_rootmsg( irc_t *irc, char *format, ... ); 321 void irc_usermsg( irc_user_t *iu, char *format, ... ); 322 void irc_usernotice( irc_user_t *iu, char *format, ... ); 320 323 void irc_send_join( irc_channel_t *ic, irc_user_t *iu ); 321 324 void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason ); -
irc_commands.c
r87dddee r6e9ae72 92 92 irc->status &= ~USTATUS_IDENTIFIED; 93 93 irc_umode_set( irc, "-R", 1 ); 94 irc_ usermsg( irc, "Changing nicks resets your identify status. "94 irc_rootmsg( irc, "Changing nicks resets your identify status. " 95 95 "Re-identify or register a new account if you want " 96 96 "your configuration to be saved. See \x02help " … … 433 433 { 434 434 set_setstr( &a->set, "password", password ); 435 irc_ usermsg( irc, "Password added to IM account "436 "%s (%s)", a->prpl->name, a->user);435 irc_rootmsg( irc, "Password added to IM account " 436 "%s", a->tag ); 437 437 /* The IRC client may expect this. 491 suggests the OPER 438 438 password was wrong, so the client won't expect a +o. 439 439 It may however repeat the password prompt. We'll see. */ 440 440 irc_send_num( irc, 491, ":Password added to IM account " 441 "%s (%s)", a->prpl->name, a->user);441 "%s", a->tag ); 442 442 } 443 443 } -
irc_im.c
r87dddee r6e9ae72 197 197 irc_t *irc = bee->ui_data; 198 198 irc_user_t *iu = (irc_user_t *) bu->ui_data; 199 char *dst, *prefix = NULL; 199 const char *dst; 200 char *prefix = NULL; 200 201 char *wrapped, *ts = NULL; 201 irc_channel_t *ic = NULL;202 202 char *msg = g_strdup( msg_ ); 203 203 GSList *l; … … 206 206 ts = irc_format_timestamp( irc, sent_at ); 207 207 208 /* Too similar to irc_usermsg()... */ 209 if( iu->last_channel ) 210 { 211 if( iu->last_channel->flags & IRC_CHANNEL_JOINED ) 212 ic = iu->last_channel; 213 else 214 ic = irc_channel_with_user( irc, iu ); 215 } 216 217 if( ic ) 218 { 219 dst = ic->name; 208 dst = irc_user_msgdest( iu ); 209 if( dst != irc->user->nick ) 210 { 211 /* if not messaging directly, call user by name */ 220 212 prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" ); 221 213 } 222 214 else 223 215 { 224 dst = irc->user->nick;225 216 prefix = ts; 226 ts = NULL; 217 ts = NULL; /* don't double-free */ 227 218 } 228 219 … … 995 986 else if( !acc->prpl->chat_join ) 996 987 { 997 irc_ usermsg( ic->irc, "Named chatrooms not supported on that account." );988 irc_rootmsg( ic->irc, "Named chatrooms not supported on that account." ); 998 989 return SET_INVALID; 999 990 } -
irc_send.c
r87dddee r6e9ae72 110 110 } 111 111 112 void irc_usermsg( irc_t *irc, char *format, ... ) 113 { 112 /* Used by some funcs that generate PRIVMSGs to figure out if we're talking to 113 this person in /query or in a control channel. WARNING: callers rely on 114 this returning a pointer at irc->user_nick, not a copy of it. */ 115 const char *irc_user_msgdest( irc_user_t *iu ) 116 { 117 irc_t *irc = iu->irc; 114 118 irc_channel_t *ic = NULL; 115 irc_user_t *iu = irc->root; 116 char text[2048]; 117 va_list params; 118 char *dst; 119 120 va_start( params, format ); 121 g_vsnprintf( text, sizeof( text ), format, params ); 122 va_end( params ); 123 124 /* Too similar to bee_irc_user_msg()... */ 119 125 120 if( iu->last_channel ) 126 121 { … … 128 123 ic = iu->last_channel; 129 124 else 130 ic = irc_channel_with_user( irc, i rc->root);125 ic = irc_channel_with_user( irc, iu ); 131 126 } 132 127 133 128 if( ic ) 134 dst =ic->name;129 return ic->name; 135 130 else 136 dst = irc->user->nick; 137 138 irc_send_msg( irc->root, "PRIVMSG", dst, text, NULL ); 131 return irc->user->nick; 132 } 133 134 /* cmd = "PRIVMSG" or "NOTICE" */ 135 static void irc_usermsg_( const char *cmd, irc_user_t *iu, const char *format, va_list params ) 136 { 137 char text[2048]; 138 const char *dst; 139 140 g_vsnprintf( text, sizeof( text ), format, params ); 141 142 dst = irc_user_msgdest( iu ); 143 irc_send_msg( iu, cmd, dst, text, NULL ); 144 } 145 146 void irc_usermsg(irc_user_t *iu, char *format, ... ) 147 { 148 va_list params; 149 va_start( params, format ); 150 irc_usermsg_( "PRIVMSG", iu, format, params ); 151 va_end( params ); 152 } 153 154 void irc_usernotice(irc_user_t *iu, char *format, ... ) 155 { 156 va_list params; 157 va_start( params, format ); 158 irc_usermsg_( "NOTICE", iu, format, params ); 159 va_end( params ); 160 } 161 162 void irc_rootmsg( irc_t *irc, char *format, ... ) 163 { 164 va_list params; 165 va_start( params, format ); 166 irc_usermsg_( "PRIVMSG", irc->root, format, params ); 167 va_end( params ); 139 168 } 140 169 -
lib/http_client.c
r87dddee r6e9ae72 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 05Wilmer van der Gaast and others *4 * Copyright 2002-2011 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 69 69 req->request_length = strlen( request ); 70 70 req->redir_ttl = 3; 71 72 if( getenv( "BITLBEE_DEBUG" ) ) 73 printf( "About to send HTTP request:\n%s\n", req->request ); 71 74 72 75 return( req ); … … 240 243 http_incoming_data, req ); 241 244 242 return FALSE; 245 if( ssl_pending( req->ssl ) ) 246 return http_incoming_data( data, source, cond ); 247 else 248 return FALSE; 243 249 244 250 got_reply: … … 275 281 276 282 *end1 = 0; 283 284 if( getenv( "BITLBEE_DEBUG" ) ) 285 printf( "HTTP response headers:\n%s\n", req->reply_headers ); 277 286 278 287 if( evil_server ) … … 314 323 } 315 324 316 if( ( req->status_code == 301 || req->status_code == 302 ) && req->redir_ttl-- > 0 ) 325 if( ( ( req->status_code >= 301 && req->status_code <= 303 ) || 326 req->status_code == 307 ) && req->redir_ttl-- > 0 ) 317 327 { 318 328 char *loc, *new_request, *new_host; … … 354 364 url_t *url; 355 365 char *s; 366 const char *new_method; 356 367 357 368 s = strstr( loc, "\r\n" ); … … 369 380 } 370 381 371 /* Okay, this isn't fun! We have to rebuild the request... :-( */ 372 new_request = g_malloc( req->request_length + strlen( url->file ) ); 373 374 /* So, now I just allocated enough memory, so I'm 375 going to use strcat(), whether you like it or not. :-) */ 376 377 sprintf( new_request, "GET %s HTTP/1.0", url->file ); 378 379 s = strstr( req->request, "\r\n" ); 380 if( s == NULL ) 382 /* Find all headers and, if necessary, the POST request contents. 383 Skip the old Host: header though. This crappy code here means 384 anything using this http_client MUST put the Host: header at 385 the top. */ 386 if( !( ( s = strstr( req->request, "\r\nHost: " ) ) && 387 ( s = strstr( s + strlen( "\r\nHost: " ), "\r\n" ) ) ) ) 381 388 { 382 389 req->status_string = g_strdup( "Error while rebuilding request string" ); 383 g_free( new_request );384 390 g_free( url ); 385 391 goto cleanup; 386 392 } 387 393 388 strcat( new_request, s ); 394 /* More or less HTTP/1.0 compliant, from my reading of RFC 2616. 395 Always perform a GET request unless we received a 301. 303 was 396 meant for this but it's HTTP/1.1-only and we're specifically 397 speaking HTTP/1.0. ... 398 399 Well except someone at identi.ca's didn't bother reading any 400 RFCs and just return HTTP/1.1-specific status codes to HTTP/1.0 401 requests. Fuckers. So here we are, handle 301..303,307. */ 402 if( strncmp( req->request, "GET", 3 ) == 0 ) 403 /* GETs never become POSTs. */ 404 new_method = "GET"; 405 else if( req->status_code == 302 || req->status_code == 303 ) 406 /* 302 de-facto becomes GET, 303 as specified by RFC 2616#10.3.3 */ 407 new_method = "GET"; 408 else 409 /* 301 de-facto should stay POST, 307 specifally RFC 2616#10.3.8 */ 410 new_method = "POST"; 411 412 /* Okay, this isn't fun! We have to rebuild the request... :-( */ 413 new_request = g_strdup_printf( "%s %s HTTP/1.0\r\nHost: %s%s", 414 new_method, url->file, url->host, s ); 415 389 416 new_host = g_strdup( url->host ); 390 417 new_port = url->port; 391 418 new_proto = url->proto; 419 420 /* If we went from POST to GET, truncate the request content. */ 421 if( new_request[0] != req->request[0] && new_request[0] == 'G' && 422 ( s = strstr( new_request, "\r\n\r\n" ) ) ) 423 s[4] = '\0'; 392 424 393 425 g_free( url ); … … 402 434 req->ssl = NULL; 403 435 436 if( getenv( "BITLBEE_DEBUG" ) ) 437 printf( "New headers for redirected HTTP request:\n%s\n", new_request ); 438 404 439 if( new_proto == PROTO_HTTPS ) 405 440 { … … 443 478 closesocket( req->fd ); 444 479 480 if( getenv( "BITLBEE_DEBUG" ) && req ) 481 printf( "Finishing HTTP request with status: %s\n", 482 req->status_string ? req->status_string : "NULL" ); 483 445 484 req->func( req ); 446 485 http_free( req ); -
lib/ssl_client.h
r87dddee r6e9ae72 63 63 G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len ); 64 64 65 /* See ssl_openssl.c for an explanation. */ 65 /* Now needed by most SSL libs. See for more info: 66 http://www.gnu.org/software/gnutls/manual/gnutls.html#index-gnutls_005frecord_005fcheck_005fpending-209 67 http://www.openssl.org/docs/ssl/SSL_pending.html 68 69 Required because OpenSSL empties the TCP buffer completely but doesn't 70 necessarily give us all the unencrypted data. Or maybe you didn't ask 71 for all of it because your buffer is too small. 72 73 Returns 0 if there's nothing left, 1 if there's more data. */ 66 74 G_MODULE_EXPORT int ssl_pending( void *conn ); 67 75 -
lib/ssl_gnutls.c
r87dddee r6e9ae72 45 45 #endif 46 46 47 #define SSLDEBUG 0 48 47 49 struct scd 48 50 { … … 135 137 gnutls_certificate_allocate_credentials( &conn->xcred ); 136 138 gnutls_init( &conn->session, GNUTLS_CLIENT ); 137 gnutls_transport_set_lowat( conn->session, 1 ); 139 #if GNUTLS_VERSION_NUMBER < 0x020c00 140 gnutls_transport_set_lowat( conn->session, 0 ); 141 #endif 138 142 gnutls_set_default_priority( conn->session ); 139 143 gnutls_credentials_set( conn->session, GNUTLS_CRD_CERTIFICATE, conn->xcred ); … … 187 191 { 188 192 ssl_errno = SSL_NOHANDSHAKE; 189 return ( -1 );193 return -1; 190 194 } 191 195 … … 196 200 ssl_errno = SSL_AGAIN; 197 201 198 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 1, buf, st );202 if( SSLDEBUG && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 2, buf, st ); 199 203 200 204 return st; … … 208 212 { 209 213 ssl_errno = SSL_NOHANDSHAKE; 210 return ( -1 );214 return -1; 211 215 } 212 216 … … 217 221 ssl_errno = SSL_AGAIN; 218 222 219 if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 1, buf, st );223 if( SSLDEBUG && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 2, buf, st ); 220 224 221 225 return st; 222 226 } 223 227 224 /* See ssl_openssl.c for an explanation. */225 228 int ssl_pending( void *conn ) 226 229 { 227 return 0; 230 if( conn == NULL ) 231 return 0; 232 233 if( !((struct scd*)conn)->established ) 234 { 235 ssl_errno = SSL_NOHANDSHAKE; 236 return 0; 237 } 238 239 return gnutls_record_check_pending( ((struct scd*)conn)->session ) != 0; 228 240 } 229 241 -
lib/ssl_nss.c
r87dddee r6e9ae72 207 207 } 208 208 209 /* See ssl_openssl.c for an explanation. */210 209 int ssl_pending( void *conn ) 211 210 { -
lib/ssl_openssl.c
r87dddee r6e9ae72 241 241 } 242 242 243 /* Only OpenSSL *really* needs this (and well, maybe NSS). See for more info:244 http://www.gnu.org/software/gnutls/manual/gnutls.html#index-gnutls_005frecord_005fcheck_005fpending-209245 http://www.openssl.org/docs/ssl/SSL_pending.html246 247 Required because OpenSSL empties the TCP buffer completely but doesn't248 necessarily give us all the unencrypted data.249 250 Returns 0 if there's nothing left or if we don't have to care (GnuTLS),251 1 if there's more data. */252 243 int ssl_pending( void *conn ) 253 244 { -
lib/xmltree.c
r87dddee r6e9ae72 323 323 } 324 324 325 #ifdef DEBUG326 325 void xt_print( struct xt_node *node ) 327 326 { … … 331 330 /* Indentation */ 332 331 for( c = node; c->parent; c = c->parent ) 333 printf(" " );332 fprintf( stderr, " " ); 334 333 335 334 /* Start the tag */ 336 printf("<%s", node->name );335 fprintf( stderr, "<%s", node->name ); 337 336 338 337 /* Print the attributes */ … … 340 339 { 341 340 char *v = g_markup_escape_text( node->attr[i].value, -1 ); 342 printf(" %s=\"%s\"", node->attr[i].key, v );341 fprintf( stderr, " %s=\"%s\"", node->attr[i].key, v ); 343 342 g_free( v ); 344 343 } … … 349 348 if( node->text == NULL && node->children == NULL ) 350 349 { 351 printf("/>\n" );350 fprintf( stderr, "/>\n" ); 352 351 return; 353 352 /* Then we're finished! */ … … 355 354 356 355 /* Otherwise... */ 357 printf(">" );356 fprintf( stderr, ">" ); 358 357 359 358 /* Only print the text if it contains more than whitespace (TEST). */ … … 364 363 { 365 364 char *v = g_markup_escape_text( node->text, -1 ); 366 printf("%s", v );365 fprintf( stderr, "%s", v ); 367 366 g_free( v ); 368 367 } … … 370 369 371 370 if( node->children ) 372 printf("\n" );371 fprintf( stderr, "\n" ); 373 372 374 373 for( c = node->children; c; c = c->next ) … … 377 376 if( node->children ) 378 377 for( c = node; c->parent; c = c->parent ) 379 printf(" " );378 fprintf( stderr, " " ); 380 379 381 380 /* Non-empty tag is now finished. */ 382 printf( "</%s>\n", node->name ); 383 } 384 #endif 381 fprintf( stderr, "</%s>\n", node->name ); 382 } 385 383 386 384 struct xt_node *xt_dup( struct xt_node *node ) … … 557 555 } 558 556 557 /* Strip a few non-printable characters that aren't allowed in XML streams 558 (and upset some XMPP servers for example). */ 559 void xt_strip_text( char *in ) 560 { 561 char *out = in; 562 static const char nonprint[32] = { 563 0, 0, 0, 0, 0, 0, 0, 0, /* 0..7 */ 564 0, 1, 1, 0, 0, 1, 0, 0, /* 9 (tab), 10 (\n), 13 (\r) */ 565 }; 566 567 if( !in ) 568 return; 569 570 while( *in ) 571 { 572 if( (unsigned int) *in >= ' ' || nonprint[(unsigned int) *in] ) 573 *out ++ = *in; 574 in ++; 575 } 576 *out = *in; 577 } 578 559 579 struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children ) 560 580 { … … 568 588 if( text ) 569 589 { 570 node->text_len = strlen( text ); 571 node->text = g_memdup( text, node->text_len + 1 ); 590 node->text = g_strdup( text ); 591 xt_strip_text( node->text ); 592 node->text_len = strlen( node->text ); 572 593 } 573 594 -
nick.c
r87dddee r6e9ae72 243 243 int i; 244 244 245 irc_ usermsg( irc, "Warning: Almost had an infinite loop in nick_get()! "245 irc_rootmsg( irc, "Warning: Almost had an infinite loop in nick_get()! " 246 246 "This used to be a fatal BitlBee bug, but we tried to fix it. " 247 247 "This message should *never* appear anymore. " … … 249 249 "Please send all the following lines in your report:" ); 250 250 251 irc_ usermsg( irc, "Trying to get a sane nick for handle %s", bu->handle );251 irc_rootmsg( irc, "Trying to get a sane nick for handle %s", bu->handle ); 252 252 for( i = 0; i < MAX_NICK_LENGTH; i ++ ) 253 irc_ usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] );254 255 irc_ usermsg( irc, "FAILED. Returning an insane nick now. Things might break. "253 irc_rootmsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] ); 254 255 irc_rootmsg( irc, "FAILED. Returning an insane nick now. Things might break. " 256 256 "Good luck, and please don't forget to paste the lines up here " 257 257 "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" ); -
otr.c
r87dddee r6e9ae72 8 8 OTR support (cf. http://www.cypherpunks.ca/otr/) 9 9 10 (c) 2008-201 0Sven Moritz Hallberg <pesco@khjk.org>10 (c) 2008-2011 Sven Moritz Hallberg <pesco@khjk.org> 11 11 (c) 2008 funded by stonedcoder.org 12 12 … … 163 163 const char *secret); 164 164 165 /* update flags within the irc_user structure to reflect OTR status of context */ 166 void otr_update_uflags(ConnContext *context, irc_user_t *u); 167 165 168 /* update op/voice flag of given user according to encryption state and settings 166 169 returns 0 if neither op_buddies nor voice_buddies is set to "encrypted", … … 182 185 /* find a private key by fingerprint prefix (given as any number of hex strings) */ 183 186 OtrlPrivKey *match_privkey(irc_t *irc, const char **args); 187 188 /* check whether a string is safe to use in a path component */ 189 int strsane(const char *s); 184 190 185 191 /* functions to be called for certain events */ … … 237 243 l = g_slist_prepend( l, "always" ); 238 244 s->eval_data = l; 245 246 s = set_add( &irc->b->set, "otr_does_html", "true", set_eval_bool, irc ); 239 247 240 248 return TRUE; … … 270 278 int kg=0; 271 279 272 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, irc->user->nick); 273 e = otrl_privkey_read(irc->otr->us, s); 274 if(e && e!=enoent) { 275 irc_usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 276 } 277 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 278 e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL); 279 if(e && e!=enoent) { 280 irc_usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 280 if(strsane(irc->user->nick)) { 281 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, irc->user->nick); 282 e = otrl_privkey_read(irc->otr->us, s); 283 if(e && e!=enoent) { 284 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 285 } 286 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 287 e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL); 288 if(e && e!=enoent) { 289 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 290 } 281 291 } 282 292 … … 286 296 } 287 297 if(kg) { 288 irc_ usermsg(irc, "Notice: "298 irc_rootmsg(irc, "Notice: " 289 299 "The accounts above do not have OTR encryption keys associated with them, yet. " 290 300 "These keys are now being generated in the background. " … … 301 311 gcry_error_t e; 302 312 303 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 304 e = otrl_privkey_write_fingerprints(irc->otr->us, s); 305 if(e) { 306 irc_usermsg(irc, "otr save: %s: %s", s, gcry_strerror(e)); 307 } 308 chmod(s, 0600); 313 if(strsane(irc->user->nick)) { 314 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 315 e = otrl_privkey_write_fingerprints(irc->otr->us, s); 316 if(e) { 317 irc_rootmsg(irc, "otr save: %s: %s", s, gcry_strerror(e)); 318 } 319 chmod(s, 0600); 320 } 309 321 } 310 322 … … 313 325 char s[512]; 314 326 315 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, nick); 316 unlink(s); 317 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, nick); 318 unlink(s); 327 if(strsane(nick)) { 328 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, nick); 329 unlink(s); 330 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, nick); 331 unlink(s); 332 } 319 333 } 320 334 … … 323 337 char s[512], t[512]; 324 338 325 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, onick); 326 g_snprintf(t, 511, "%s%s.otr_keys", global.conf->configdir, nnick); 327 rename(s,t); 328 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, onick); 329 g_snprintf(t, 511, "%s%s.otr_fprints", global.conf->configdir, nnick); 330 rename(s,t); 339 if(strsane(nnick) && strsane(onick)) { 340 g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, onick); 341 g_snprintf(t, 511, "%s%s.otr_keys", global.conf->configdir, nnick); 342 rename(s,t); 343 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, onick); 344 g_snprintf(t, 511, "%s%s.otr_fprints", global.conf->configdir, nnick); 345 rename(s,t); 346 } 331 347 } 332 348 … … 343 359 k = otrl_privkey_find(irc->otr->us, a->user, a->prpl->name); 344 360 if(k) { 345 irc_ usermsg(irc, "otr: %s/%s ready", a->user, a->prpl->name);361 irc_rootmsg(irc, "otr: %s/%s ready", a->user, a->prpl->name); 346 362 return 0; 347 363 } if(keygen_in_progress(irc, a->user, a->prpl->name)) { 348 irc_ usermsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name);364 irc_rootmsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name); 349 365 return 0; 350 366 } else { 351 irc_ usermsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name);367 irc_rootmsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name); 352 368 otr_keygen(irc, a->user, a->prpl->name); 353 369 return 1; … … 360 376 char *newmsg = NULL; 361 377 OtrlTLV *tlvs = NULL; 362 char *colormsg;363 378 irc_t *irc = iu->irc; 364 379 struct im_connection *ic = iu->bu->ic; … … 380 395 } else if(!newmsg) { 381 396 /* this was a non-OTR message */ 382 return g_strdup(msg);397 return msg; 383 398 } else { 384 399 /* OTR has processed this message */ 385 400 ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle, 386 401 ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL); 387 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED && 388 set_getbool(&ic->bee->set, "otr_color_encrypted")) { 389 /* color according to f'print trust */ 390 int color; 391 const char *trust = context->active_fingerprint->trust; 392 if(trust && trust[0] != '\0') 393 color=3; /* green */ 394 else 395 color=5; /* red */ 396 397 if(newmsg[0] == ',') { 398 /* could be a problem with the color code */ 399 /* insert a space between color spec and message */ 400 colormsg = g_strdup_printf("\x03%.2d %s\x0F", color, newmsg); 401 } else { 402 colormsg = g_strdup_printf("\x03%.2d%s\x0F", color, newmsg); 402 403 /* we're done with the original msg, which will be caller-freed. */ 404 /* NB: must not change the newmsg pointer, since we free it. */ 405 msg = newmsg; 406 407 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 408 /* HTML decoding */ 409 /* perform any necessary stripping that the top level would miss */ 410 if(set_getbool(&ic->bee->set, "otr_does_html") && 411 !(ic->flags & OPT_DOES_HTML) && 412 set_getbool(&ic->bee->set, "strip_html")) { 413 strip_html(msg); 403 414 } 404 } else { 405 colormsg = g_strdup(newmsg); 415 416 /* coloring */ 417 if(set_getbool(&ic->bee->set, "otr_color_encrypted")) { 418 int color; /* color according to f'print trust */ 419 char *pre="", *sep=""; /* optional parts */ 420 const char *trust = context->active_fingerprint->trust; 421 422 if(trust && trust[0] != '\0') 423 color=3; /* green */ 424 else 425 color=5; /* red */ 426 427 /* in a query window, keep "/me " uncolored at the beginning */ 428 if(g_strncasecmp(msg, "/me ", 4) == 0 429 && irc_user_msgdest(iu) == irc->user->nick) { 430 msg += 4; /* skip */ 431 pre = "/me "; 432 } 433 434 /* comma in first place could mess with the color code */ 435 if(msg[0] == ',') { 436 /* insert a space between color spec and message */ 437 sep = " "; 438 } 439 440 msg = g_strdup_printf("%s\x03%.2d%s%s\x0F", pre, 441 color, sep, msg); 442 } 443 } 444 445 if(msg == newmsg) { 446 msg = g_strdup(newmsg); 406 447 } 407 448 otrl_message_free(newmsg); 408 return colormsg;449 return msg; 409 450 } 410 451 } … … 414 455 int st; 415 456 char *otrmsg = NULL; 457 char *emsg = msg; /* the message as we hand it to libotr */ 416 458 ConnContext *ctx = NULL; 417 459 irc_t *irc = iu->irc; … … 422 464 return msg; 423 465 } 424 425 st = otrl_message_sending(irc->otr->us, &otr_ops, ic,426 ic->acc->user, ic->acc->prpl->name, iu->bu->handle,427 msg, NULL, &otrmsg, NULL, NULL);428 if(st) {429 return NULL;430 }431 466 432 467 ctx = otrl_context_find(irc->otr->us, 433 468 iu->bu->handle, ic->acc->user, ic->acc->prpl->name, 434 469 1, NULL, NULL, NULL); 470 471 /* HTML encoding */ 472 /* consider OTR plaintext to be HTML if otr_does_html is set */ 473 if(ctx && ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED && 474 set_getbool(&ic->bee->set, "otr_does_html") && 475 (g_strncasecmp(msg, "<html>", 6) != 0)) { 476 emsg = escape_html(msg); 477 } 478 479 st = otrl_message_sending(irc->otr->us, &otr_ops, ic, 480 ic->acc->user, ic->acc->prpl->name, iu->bu->handle, 481 emsg, NULL, &otrmsg, NULL, NULL); 482 if(emsg != msg) { 483 g_free(emsg); /* we're done with this one */ 484 } 485 if(st) { 486 return NULL; 487 } 435 488 436 489 if(otrmsg) { … … 480 533 481 534 if(!cmd->command) { 482 irc_ usermsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02",535 irc_rootmsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02", 483 536 args[0], args[1]); 484 537 return; … … 486 539 487 540 if(!args[cmd->required_parameters+1]) { 488 irc_ usermsg(irc, "%s %s: not enough arguments (%d req.)",541 irc_rootmsg(irc, "%s %s: not enough arguments (%d req.)", 489 542 args[0], args[1], cmd->required_parameters); 490 543 return; … … 558 611 if (strcmp(accountname, recipient) == 0) { 559 612 /* huh? injecting messages to myself? */ 560 irc_ usermsg(irc, "note to self: %s", message);613 irc_rootmsg(irc, "note to self: %s", message); 561 614 } else { 562 615 /* need to drop some consts here :-( */ … … 573 626 char *msg = g_strdup(message); 574 627 irc_t *irc = ic->bee->ui_data; 628 irc_user_t *u = peeruser(irc, username, protocol); 575 629 576 630 strip_html(msg); 577 irc_usermsg(irc, "otr: %s", msg); 631 if(u) { 632 /* display as a notice from this particular user */ 633 irc_usernotice(u, "%s", msg); 634 } else { 635 irc_rootmsg(irc, "[otr] %s", msg); 636 } 578 637 579 638 g_free(msg); … … 587 646 struct im_connection *ic = check_imc(opdata, accountname, protocol); 588 647 irc_t *irc = ic->bee->ui_data; 648 irc_user_t *u = peeruser(irc, username, protocol); 589 649 char hunam[45]; /* anybody looking? ;-) */ 590 650 591 651 otrl_privkey_hash_to_human(hunam, fingerprint); 592 irc_usermsg(irc, "new fingerprint for %s: %s", 593 peernick(irc, username, protocol), hunam); 652 if(u) { 653 irc_usernotice(u, "new fingerprint: %s", hunam); 654 } else { 655 /* this case shouldn't normally happen */ 656 irc_rootmsg(irc, "new fingerprint for %s/%s: %s", 657 username, protocol, hunam); 658 } 594 659 } 595 660 … … 608 673 irc_user_t *u; 609 674 irc_t *irc = ic->bee->ui_data; 610 const char *trust;611 675 612 676 u = peeruser(irc, context->username, context->protocol); … … 618 682 } 619 683 620 trust = context->active_fingerprint->trust; 621 if(trust && trust[0]) 622 u->flags |= IRC_USER_OTR_ENCRYPTED | IRC_USER_OTR_TRUSTED; 623 else 624 u->flags = ( u->flags & ~IRC_USER_OTR_TRUSTED ) | IRC_USER_OTR_ENCRYPTED; 625 if(!otr_update_modeflags(irc, u)) 626 irc_usermsg(irc, "conversation with %s is now off the record", u->nick); 684 otr_update_uflags(context, u); 685 if(!otr_update_modeflags(irc, u)) { 686 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 687 irc_usernotice(u, "conversation is now off the record (%s)", trust); 688 } 627 689 } 628 690 … … 641 703 return; 642 704 } 643 u->flags &= ~( IRC_USER_OTR_ENCRYPTED | IRC_USER_OTR_TRUSTED);705 otr_update_uflags(context, u); 644 706 if(!otr_update_modeflags(irc, u)) 645 irc_user msg(irc, "conversation with %s is now in the clear", u->nick);707 irc_usernotice(u, "conversation is now in cleartext"); 646 708 } 647 709 … … 660 722 return; 661 723 } 662 if(context->active_fingerprint->trust[0]) 663 u->flags |= IRC_USER_OTR_ENCRYPTED | IRC_USER_OTR_TRUSTED;664 else665 u->flags = ( u->flags & ~IRC_USER_OTR_TRUSTED ) | IRC_USER_OTR_ENCRYPTED;666 if(!otr_update_modeflags(irc, u))667 irc_usermsg(irc, "otr connection with %s has been refreshed", u->nick);724 725 otr_update_uflags(context, u); 726 if(!otr_update_modeflags(irc, u)) { 727 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 728 irc_usernotice(u, "otr connection has been refreshed (%s)", trust); 729 } 668 730 } 669 731 … … 708 770 u = irc_user_by_name(irc, args[1]); 709 771 if(!u || !u->bu || !u->bu->ic) { 710 irc_ usermsg(irc, "%s: unknown user", args[1]);772 irc_rootmsg(irc, "%s: unknown user", args[1]); 711 773 return; 712 774 } … … 733 795 u = irc_user_by_name(irc, args[1]); 734 796 if(!u || !u->bu || !u->bu->ic) { 735 irc_ usermsg(irc, "%s: unknown user", args[1]);797 irc_rootmsg(irc, "%s: unknown user", args[1]); 736 798 return; 737 799 } 738 800 if(!(u->bu->flags & BEE_USER_ONLINE)) { 739 irc_ usermsg(irc, "%s is offline", args[1]);801 irc_rootmsg(irc, "%s is offline", args[1]); 740 802 return; 741 803 } … … 764 826 u = irc_user_by_name(irc, args[1]); 765 827 if(!u || !u->bu || !u->bu->ic) { 766 irc_ usermsg(irc, "%s: unknown user", args[1]);828 irc_rootmsg(irc, "%s: unknown user", args[1]); 767 829 return; 768 830 } … … 771 833 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 772 834 if(!ctx) { 773 irc_ usermsg(irc, "%s: no otr context with user", args[1]);835 irc_rootmsg(irc, "%s: no otr context with user", args[1]); 774 836 return; 775 837 } … … 783 845 784 846 if(!*p || !*q) { 785 irc_ usermsg(irc, "failed: truncated fingerprint block %d", i+1);847 irc_rootmsg(irc, "failed: truncated fingerprint block %d", i+1); 786 848 return; 787 849 } … … 790 852 y = hexval(*q); 791 853 if(x<0) { 792 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1);854 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1); 793 855 return; 794 856 } 795 857 if(y<0) { 796 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1);858 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1); 797 859 return; 798 860 } … … 803 865 fp = otrl_context_find_fingerprint(ctx, raw, 0, NULL); 804 866 if(!fp) { 805 irc_ usermsg(irc, "failed: no such fingerprint for %s", args[1]);867 irc_rootmsg(irc, "failed: no such fingerprint for %s", args[1]); 806 868 } else { 807 869 char *trust = args[7] ? args[7] : "affirmed"; 808 870 otrl_context_set_trust(fp, trust); 809 irc_ usermsg(irc, "fingerprint match, trust set to \"%s\"", trust);871 irc_rootmsg(irc, "fingerprint match, trust set to \"%s\"", trust); 810 872 if(u->flags & IRC_USER_OTR_ENCRYPTED) 811 873 u->flags |= IRC_USER_OTR_TRUSTED; … … 835 897 ctx = otrl_context_find(irc->otr->us, handle, myhandle, protocol, 0, NULL, NULL, NULL); 836 898 if(!ctx) { 837 irc_ usermsg(irc, "no such context");899 irc_rootmsg(irc, "no such context"); 838 900 g_free(arg); 839 901 return; … … 842 904 irc_user_t *u = irc_user_by_name(irc, args[1]); 843 905 if(!u || !u->bu || !u->bu->ic) { 844 irc_ usermsg(irc, "%s: unknown user", args[1]);906 irc_rootmsg(irc, "%s: unknown user", args[1]); 845 907 g_free(arg); 846 908 return; … … 849 911 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 850 912 if(!ctx) { 851 irc_ usermsg(irc, "no otr context with %s", args[1]);913 irc_rootmsg(irc, "no otr context with %s", args[1]); 852 914 g_free(arg); 853 915 return; … … 857 919 /* show how we resolved the (nick) argument, if we did */ 858 920 if(handle!=arg) { 859 irc_ usermsg(irc, "%s is %s/%s; we are %s/%s to them", args[1],921 irc_rootmsg(irc, "%s is %s/%s; we are %s/%s to them", args[1], 860 922 ctx->username, ctx->protocol, ctx->accountname, ctx->protocol); 861 923 } … … 872 934 n = atoi(args[1]); 873 935 if(n<0 || (!n && strcmp(args[1], "0"))) { 874 irc_ usermsg(irc, "%s: invalid account number", args[1]);936 irc_rootmsg(irc, "%s: invalid account number", args[1]); 875 937 return; 876 938 } … … 879 941 for(i=0; i<n && a; i++, a=a->next); 880 942 if(!a) { 881 irc_ usermsg(irc, "%s: no such account", args[1]);943 irc_rootmsg(irc, "%s: no such account", args[1]); 882 944 return; 883 945 } 884 946 885 947 if(keygen_in_progress(irc, a->user, a->prpl->name)) { 886 irc_ usermsg(irc, "keygen for account %d already in progress", n);948 irc_rootmsg(irc, "keygen for account %d already in progress", n); 887 949 return; 888 950 } … … 906 968 907 969 if(fp == fp->context->active_fingerprint) { 908 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");970 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 909 971 return; 910 972 } … … 922 984 923 985 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 924 irc_ usermsg(irc, "active otr connection with %s, terminate it first",986 irc_rootmsg(irc, "active otr connection with %s, terminate it first", 925 987 peernick(irc, ctx->username, ctx->protocol)); 926 988 return; … … 954 1016 955 1017 if(!args[3]) { 956 irc_ usermsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]);1018 irc_rootmsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]); 957 1019 return; 958 1020 } … … 961 1023 u = irc_user_by_name(irc, args[2]); 962 1024 if(!u || !u->bu || !u->bu->ic) { 963 irc_ usermsg(irc, "%s: unknown user", args[2]);1025 irc_rootmsg(irc, "%s: unknown user", args[2]); 964 1026 return; 965 1027 } … … 968 1030 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 969 1031 if(!ctx) { 970 irc_ usermsg(irc, "no otr context with %s", args[2]);1032 irc_rootmsg(irc, "no otr context with %s", args[2]); 971 1033 return; 972 1034 } … … 979 1041 980 1042 if(fp == ctx->active_fingerprint) { 981 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");1043 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 982 1044 return; 983 1045 } … … 1004 1066 u = irc_user_by_name(irc, args[2]); 1005 1067 if(!u || !u->bu || !u->bu->ic) { 1006 irc_ usermsg(irc, "%s: unknown user", args[2]);1068 irc_rootmsg(irc, "%s: unknown user", args[2]); 1007 1069 return; 1008 1070 } … … 1011 1073 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1012 1074 if(!ctx) { 1013 irc_ usermsg(irc, "no otr context with %s", args[2]);1075 irc_rootmsg(irc, "no otr context with %s", args[2]); 1014 1076 return; 1015 1077 } 1016 1078 1017 1079 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1018 irc_ usermsg(irc, "active otr connection with %s, terminate it first", args[2]);1080 irc_rootmsg(irc, "active otr connection with %s, terminate it first", args[2]); 1019 1081 return; 1020 1082 } … … 1049 1111 else 1050 1112 { 1051 irc_ usermsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",1113 irc_rootmsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02", 1052 1114 args[0], args[1]); 1053 1115 } … … 1075 1137 if(!context) { 1076 1138 /* huh? out of memory or what? */ 1077 irc_ usermsg(irc, "smp: failed to get otr context for %s", u->nick);1139 irc_rootmsg(irc, "smp: failed to get otr context for %s", u->nick); 1078 1140 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1079 1141 otrl_sm_state_free(context->smstate); … … 1083 1145 1084 1146 if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) { 1085 irc_ usermsg(irc, "smp %s: opponent violated protocol, aborting",1147 irc_rootmsg(irc, "smp %s: opponent violated protocol, aborting", 1086 1148 u->nick); 1087 1149 otrl_message_abort_smp(us, ops, u->bu->ic, context); … … 1093 1155 if (tlv) { 1094 1156 if (nextMsg != OTRL_SMP_EXPECT1) { 1095 irc_ usermsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick);1157 irc_rootmsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick); 1096 1158 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1097 1159 otrl_sm_state_free(context->smstate); 1098 1160 } else { 1099 1161 char *question = g_strndup((char *)tlv->data, tlv->len); 1100 irc_ usermsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,1162 irc_rootmsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick, 1101 1163 question); 1102 irc_ usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",1164 irc_rootmsg(irc, "smp: respond with \x02otr smp %s <answer>\x02", 1103 1165 u->nick); 1104 1166 g_free(question); … … 1109 1171 if (tlv) { 1110 1172 if (nextMsg != OTRL_SMP_EXPECT1) { 1111 irc_ usermsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick);1173 irc_rootmsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick); 1112 1174 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1113 1175 otrl_sm_state_free(context->smstate); 1114 1176 } else { 1115 irc_ usermsg(irc, "smp: initiated by %s"1177 irc_rootmsg(irc, "smp: initiated by %s" 1116 1178 " - respond with \x02otr smp %s <secret>\x02", 1117 1179 u->nick, u->nick); … … 1122 1184 if (tlv) { 1123 1185 if (nextMsg != OTRL_SMP_EXPECT2) { 1124 irc_ usermsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick);1186 irc_rootmsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick); 1125 1187 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1126 1188 otrl_sm_state_free(context->smstate); … … 1133 1195 if (tlv) { 1134 1196 if (nextMsg != OTRL_SMP_EXPECT3) { 1135 irc_ usermsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick);1197 irc_rootmsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick); 1136 1198 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1137 1199 otrl_sm_state_free(context->smstate); … … 1140 1202 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1141 1203 if(context->smstate->received_question) { 1142 irc_ usermsg(irc, "smp %s: correct answer, you are trusted",1204 irc_rootmsg(irc, "smp %s: correct answer, you are trusted", 1143 1205 u->nick); 1144 1206 } else { 1145 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1207 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1146 1208 u->nick); 1147 1209 } 1148 1210 } else { 1149 1211 if(context->smstate->received_question) { 1150 irc_ usermsg(irc, "smp %s: wrong answer, you are not trusted",1212 irc_rootmsg(irc, "smp %s: wrong answer, you are not trusted", 1151 1213 u->nick); 1152 1214 } else { 1153 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1215 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1154 1216 u->nick); 1155 1217 } … … 1162 1224 if (tlv) { 1163 1225 if (nextMsg != OTRL_SMP_EXPECT4) { 1164 irc_ usermsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick);1226 irc_rootmsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick); 1165 1227 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1166 1228 otrl_sm_state_free(context->smstate); … … 1168 1230 /* SMP4 received, otrl_message_receiving will have set fp trust */ 1169 1231 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1170 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1232 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1171 1233 u->nick); 1172 1234 } else { 1173 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1235 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1174 1236 u->nick); 1175 1237 } … … 1180 1242 tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT); 1181 1243 if (tlv) { 1182 irc_ usermsg(irc, "smp: received abort from %s", u->nick);1244 irc_rootmsg(irc, "smp: received abort from %s", u->nick); 1183 1245 otrl_sm_state_free(context->smstate); 1184 1246 /* smp is in back in EXPECT1 */ … … 1195 1257 u = irc_user_by_name(irc, nick); 1196 1258 if(!u || !u->bu || !u->bu->ic) { 1197 irc_ usermsg(irc, "%s: unknown user", nick);1259 irc_rootmsg(irc, "%s: unknown user", nick); 1198 1260 return; 1199 1261 } 1200 1262 if(!(u->bu->flags & BEE_USER_ONLINE)) { 1201 irc_ usermsg(irc, "%s is offline", nick);1263 irc_rootmsg(irc, "%s is offline", nick); 1202 1264 return; 1203 1265 } … … 1206 1268 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1207 1269 if(!ctx || ctx->msgstate != OTRL_MSGSTATE_ENCRYPTED) { 1208 irc_ usermsg(irc, "smp: otr inactive with %s, try \x02otr connect"1270 irc_rootmsg(irc, "smp: otr inactive with %s, try \x02otr connect" 1209 1271 " %s\x02", nick, nick); 1210 1272 return; … … 1221 1283 if(question) { 1222 1284 /* this was 'otr smpq', just initiate */ 1223 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1285 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1224 1286 otrl_message_initiate_smp_q(irc->otr->us, &otr_ops, u->bu->ic, ctx, 1225 1287 question, (unsigned char *)secret, strlen(secret)); … … 1230 1292 is completed or aborted! */ 1231 1293 if(ctx->smstate->secret == NULL) { 1232 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1294 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1233 1295 otrl_message_initiate_smp(irc->otr->us, &otr_ops, 1234 1296 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1237 1299 /* if we're still in EXPECT1 but smstate is initialized, we must have 1238 1300 received the SMP1, so let's issue a response */ 1239 irc_ usermsg(irc, "smp: responding to %s...", u->nick);1301 irc_rootmsg(irc, "smp: responding to %s...", u->nick); 1240 1302 otrl_message_respond_smp(irc->otr->us, &otr_ops, 1241 1303 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1312 1374 } 1313 1375 1376 void otr_update_uflags(ConnContext *context, irc_user_t *u) 1377 { 1378 const char *trust; 1379 1380 if(context->active_fingerprint) { 1381 u->flags |= IRC_USER_OTR_ENCRYPTED; 1382 1383 trust = context->active_fingerprint->trust; 1384 if(trust && trust[0]) 1385 u->flags |= IRC_USER_OTR_TRUSTED; 1386 else 1387 u->flags &= ~IRC_USER_OTR_TRUSTED; 1388 } else { 1389 u->flags &= ~IRC_USER_OTR_ENCRYPTED; 1390 } 1391 } 1392 1314 1393 int otr_update_modeflags(irc_t *irc, irc_user_t *u) 1315 1394 { 1316 return 1;1395 return 0; 1317 1396 } 1318 1397 … … 1335 1414 } 1336 1415 if(fp == ctx->active_fingerprint) { 1337 irc_ usermsg(irc, " \x02%s (%s)\x02", human, trust);1416 irc_rootmsg(irc, " \x02%s (%s)\x02", human, trust); 1338 1417 } else { 1339 irc_ usermsg(irc, " %s (%s)", human, trust);1418 irc_rootmsg(irc, " %s (%s)", human, trust); 1340 1419 } 1341 1420 } 1342 1421 if(count==0) 1343 irc_ usermsg(irc, " (none)");1422 irc_rootmsg(irc, " (none)"); 1344 1423 } 1345 1424 … … 1360 1439 1361 1440 if(n>=40) { 1362 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1441 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1363 1442 return NULL; 1364 1443 } … … 1367 1446 *(p++) = c; 1368 1447 } else { 1369 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1448 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1370 1449 return NULL; 1371 1450 } … … 1388 1467 } 1389 1468 if(!fp) { 1390 irc_ usermsg(irc, "%s: no match", prefix);1469 irc_rootmsg(irc, "%s: no match", prefix); 1391 1470 return NULL; 1392 1471 } … … 1401 1480 } 1402 1481 if(fp2) { 1403 irc_ usermsg(irc, "%s: multiple matches", prefix);1482 irc_rootmsg(irc, "%s: multiple matches", prefix); 1404 1483 return NULL; 1405 1484 } … … 1424 1503 1425 1504 if(n>=40) { 1426 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1505 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1427 1506 return NULL; 1428 1507 } … … 1431 1510 *(p++) = c; 1432 1511 } else { 1433 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1512 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1434 1513 return NULL; 1435 1514 } … … 1452 1531 } 1453 1532 if(!k) { 1454 irc_ usermsg(irc, "%s: no match", prefix);1533 irc_rootmsg(irc, "%s: no match", prefix); 1455 1534 return NULL; 1456 1535 } … … 1465 1544 } 1466 1545 if(k2) { 1467 irc_ usermsg(irc, "%s: multiple matches", prefix);1546 irc_rootmsg(irc, "%s: multiple matches", prefix); 1468 1547 return NULL; 1469 1548 } … … 1480 1559 1481 1560 /* list all privkeys (including ones being generated) */ 1482 irc_ usermsg(irc, "\x1fprivate keys:\x1f");1561 irc_rootmsg(irc, "\x1fprivate keys:\x1f"); 1483 1562 for(key=irc->otr->us->privkey_root; key; key=key->next) { 1484 1563 const char *hash; … … 1486 1565 switch(key->pubkey_type) { 1487 1566 case OTRL_PUBKEY_TYPE_DSA: 1488 irc_ usermsg(irc, " %s/%s - DSA", key->accountname, key->protocol);1567 irc_rootmsg(irc, " %s/%s - DSA", key->accountname, key->protocol); 1489 1568 break; 1490 1569 default: 1491 irc_ usermsg(irc, " %s/%s - type %d", key->accountname, key->protocol,1570 irc_rootmsg(irc, " %s/%s - type %d", key->accountname, key->protocol, 1492 1571 key->pubkey_type); 1493 1572 } … … 1498 1577 hash = otrl_privkey_fingerprint(irc->otr->us, human, key->accountname, key->protocol); 1499 1578 if(hash) /* should always succeed */ 1500 irc_ usermsg(irc, " %s", human);1579 irc_rootmsg(irc, " %s", human); 1501 1580 } 1502 1581 if(irc->otr->sent_accountname) { 1503 irc_ usermsg(irc, " %s/%s - DSA", irc->otr->sent_accountname,1582 irc_rootmsg(irc, " %s/%s - DSA", irc->otr->sent_accountname, 1504 1583 irc->otr->sent_protocol); 1505 irc_ usermsg(irc, " (being generated)");1584 irc_rootmsg(irc, " (being generated)"); 1506 1585 } 1507 1586 for(kg=irc->otr->todo; kg; kg=kg->next) { 1508 irc_ usermsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol);1509 irc_ usermsg(irc, " (queued)");1587 irc_rootmsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol); 1588 irc_rootmsg(irc, " (queued)"); 1510 1589 } 1511 1590 if(key == irc->otr->us->privkey_root && 1512 1591 !irc->otr->sent_accountname && 1513 1592 kg == irc->otr->todo) 1514 irc_ usermsg(irc, " (none)");1593 irc_rootmsg(irc, " (none)"); 1515 1594 1516 1595 /* list all contexts */ 1517 irc_ usermsg(irc, "%s", "");1518 irc_ usermsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)");1596 irc_rootmsg(irc, "%s", ""); 1597 irc_rootmsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)"); 1519 1598 for(ctx=irc->otr->us->context_root; ctx; ctx=ctx->next) {\ 1520 1599 irc_user_t *u; … … 1530 1609 1531 1610 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1532 irc_ usermsg(irc, " \x02%s\x02", userstring);1611 irc_rootmsg(irc, " \x02%s\x02", userstring); 1533 1612 } else { 1534 irc_ usermsg(irc, " %s", userstring);1613 irc_rootmsg(irc, " %s", userstring); 1535 1614 } 1536 1615 … … 1538 1617 } 1539 1618 if(ctx == irc->otr->us->context_root) 1540 irc_ usermsg(irc, " (none)");1619 irc_rootmsg(irc, " (none)"); 1541 1620 } 1542 1621 … … 1545 1624 switch(ctx->otr_offer) { 1546 1625 case OFFER_NOT: 1547 irc_ usermsg(irc, " otr offer status: none sent");1626 irc_rootmsg(irc, " otr offer status: none sent"); 1548 1627 break; 1549 1628 case OFFER_SENT: 1550 irc_ usermsg(irc, " otr offer status: awaiting reply");1629 irc_rootmsg(irc, " otr offer status: awaiting reply"); 1551 1630 break; 1552 1631 case OFFER_ACCEPTED: 1553 irc_ usermsg(irc, " otr offer status: accepted our offer");1632 irc_rootmsg(irc, " otr offer status: accepted our offer"); 1554 1633 break; 1555 1634 case OFFER_REJECTED: 1556 irc_ usermsg(irc, " otr offer status: ignored our offer");1635 irc_rootmsg(irc, " otr offer status: ignored our offer"); 1557 1636 break; 1558 1637 default: 1559 irc_ usermsg(irc, " otr offer status: %d", ctx->otr_offer);1638 irc_rootmsg(irc, " otr offer status: %d", ctx->otr_offer); 1560 1639 } 1561 1640 1562 1641 switch(ctx->msgstate) { 1563 1642 case OTRL_MSGSTATE_PLAINTEXT: 1564 irc_ usermsg(irc, " connection state: cleartext");1643 irc_rootmsg(irc, " connection state: cleartext"); 1565 1644 break; 1566 1645 case OTRL_MSGSTATE_ENCRYPTED: 1567 irc_ usermsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version);1646 irc_rootmsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version); 1568 1647 break; 1569 1648 case OTRL_MSGSTATE_FINISHED: 1570 irc_ usermsg(irc, " connection state: shut down");1649 irc_rootmsg(irc, " connection state: shut down"); 1571 1650 break; 1572 1651 default: 1573 irc_ usermsg(irc, " connection state: %d", ctx->msgstate);1574 } 1575 1576 irc_ usermsg(irc, " fingerprints: (bold=active)");1652 irc_rootmsg(irc, " connection state: %d", ctx->msgstate); 1653 } 1654 1655 irc_rootmsg(irc, " fingerprints: (bold=active)"); 1577 1656 show_fingerprints(irc, ctx); 1578 1657 } … … 1614 1693 1615 1694 if(pipe(to) < 0 || pipe(from) < 0) { 1616 irc_ usermsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno));1695 irc_rootmsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno)); 1617 1696 return; 1618 1697 } … … 1621 1700 fromf = fdopen(from[0], "r"); 1622 1701 if(!tof || !fromf) { 1623 irc_ usermsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno));1702 irc_rootmsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno)); 1624 1703 return; 1625 1704 } … … 1627 1706 p = fork(); 1628 1707 if(p<0) { 1629 irc_ usermsg(irc, "otr keygen: couldn't fork: %s", strerror(errno));1708 irc_rootmsg(irc, "otr keygen: couldn't fork: %s", strerror(errno)); 1630 1709 return; 1631 1710 } … … 1707 1786 myfgets(msg, 512, irc->otr->from); 1708 1787 1709 irc_ usermsg(irc, "%s", msg);1788 irc_rootmsg(irc, "%s", msg); 1710 1789 if(filename[0]) { 1711 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); 1712 char *tmp = g_strdup_printf("%s.new", kf); 1713 copyfile(filename, tmp); 1714 unlink(filename); 1715 rename(tmp,kf); 1716 otrl_privkey_read(irc->otr->us, kf); 1717 g_free(kf); 1718 g_free(tmp); 1790 if(strsane(irc->user->nick)) { 1791 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); 1792 char *tmp = g_strdup_printf("%s.new", kf); 1793 copyfile(filename, tmp); 1794 unlink(filename); 1795 rename(tmp,kf); 1796 otrl_privkey_read(irc->otr->us, kf); 1797 g_free(kf); 1798 g_free(tmp); 1799 } else { 1800 otrl_privkey_read(irc->otr->us, filename); 1801 unlink(filename); 1802 } 1719 1803 } 1720 1804 … … 1781 1865 1782 1866 if(keygen_in_progress(irc, acc->user, acc->prpl->name)) { 1783 irc_ usermsg(irc, "keygen for %s/%s already in progress",1867 irc_rootmsg(irc, "keygen for %s/%s already in progress", 1784 1868 acc->user, acc->prpl->name); 1785 1869 } else { 1786 irc_ usermsg(irc, "starting background keygen for %s/%s",1870 irc_rootmsg(irc, "starting background keygen for %s/%s", 1787 1871 acc->user, acc->prpl->name); 1788 irc_ usermsg(irc, "you will be notified when it completes");1872 irc_rootmsg(irc, "you will be notified when it completes"); 1789 1873 otr_keygen(irc, acc->user, acc->prpl->name); 1790 1874 } 1791 1875 } 1876 1877 /* check whether a string is safe to use in a path component */ 1878 int strsane(const char *s) 1879 { 1880 return strpbrk(s, "/\\") == NULL; 1881 } 1882 1883 /* vim: set noet ts=4 sw=4: */ -
protocols/jabber/io.c
r87dddee r6e9ae72 212 212 this is an old server that can't do SASL 213 213 authentication. */ 214 if( !s asl_supported( ic ) )214 if( !set_getbool( &ic->acc->set, "sasl") || !sasl_supported( ic ) ) 215 215 { 216 216 /* If there's no version= tag, we suppose … … 375 375 other way. jabber.com doesn't seem to do SASL while it pretends 376 376 to be XMPP 1.0 compliant! */ 377 else if( !( jd->flags & JFLAG_AUTHENTICATED ) && s asl_supported( ic ) )377 else if( !( jd->flags & JFLAG_AUTHENTICATED ) && set_getbool( &ic->acc->set, "sasl") && sasl_supported( ic ) ) 378 378 { 379 379 if( !jabber_init_iq_auth( ic ) ) -
protocols/jabber/jabber.c
r87dddee r6e9ae72 84 84 s->flags |= ACC_SET_OFFLINE_ONLY; 85 85 86 s = set_add( &acc->set, "sasl", "true", set_eval_bool, acc ); 87 s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT; 88 86 89 s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); 87 90 -
protocols/jabber/s5bytestream.c
r87dddee r6e9ae72 877 877 878 878 if( ( ( host = strchr( proxy, ',' ) ) == 0 ) || 879 ( ( port = strchr( host+1, ',' ) ) == 0 ) ) { 879 ( ( port = strchr( host+1, ',' ) ) == 0 ) ) 880 { 880 881 imcb_log( ic, "Error parsing proxy setting: \"%s\" (ignored)", proxy ); 881 882 return NULL; … … 889 890 sh->jid = g_strdup( jid ); 890 891 sh->host = g_strdup( host ); 891 strcpy( sh->port, port );892 g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); 892 893 893 894 return sh; … … 915 916 sh->jid = g_strdup( tf->ini_jid ); 916 917 sh->host = g_strdup( host ); 917 strcpy( sh->port, port );918 g_snprintf( sh->port, sizeof( sh->port ), "%s", port ); 918 919 bt->streamhosts = g_slist_append( bt->streamhosts, sh ); 919 920 -
protocols/msn/ns.c
r87dddee r6e9ae72 480 480 else 481 481 { 482 imcb_error( ic, "Session terminated by remote server (reason unknown)" ); 482 imcb_error( ic, "Session terminated by remote server (%s)", 483 cmd[1] ? cmd[1] : "reason unknown)" ); 483 484 } 484 485 -
protocols/msn/sb.c
r87dddee r6e9ae72 308 308 struct msn_switchboard *sb = data; 309 309 struct im_connection *ic; 310 struct msn_data *md;311 310 char buf[1024]; 312 311 … … 316 315 317 316 ic = sb->ic; 318 md = ic->proto_data;319 317 320 318 if( source != sb->fd ) … … 675 673 struct im_connection *ic = sb->ic; 676 674 char *body; 677 int blen = 0;678 675 679 676 if( !num_parts ) … … 681 678 682 679 if( ( body = strstr( msg, "\r\n\r\n" ) ) ) 683 {684 680 body += 4; 685 blen = msglen - ( body - msg );686 }687 681 688 682 if( strcmp( cmd[0], "MSG" ) == 0 ) -
protocols/msn/soap.c
r87dddee r6e9ae72 210 210 { 211 211 char *s; 212 int st;213 212 214 213 if( !getenv( "BITLBEE_DEBUG" ) ) 215 214 return; 216 215 217 if( ( s = strstr( headers, "\r\n\r\n" ) ) ) 218 st = write( 1, s, s - headers + 4 ); 219 else 220 st = write( 1, headers, strlen( headers ) ); 221 222 #ifdef DEBUG 216 if( headers ) 217 { 218 if( ( s = strstr( headers, "\r\n\r\n" ) ) ) 219 write( 2, headers, s - headers + 4 ); 220 else 221 write( 2, headers, strlen( headers ) ); 222 } 223 224 if( payload ) 223 225 { 224 226 struct xt_node *xt = xt_from_string( payload ); … … 227 229 xt_free_node( xt ); 228 230 } 229 #endif230 231 } 231 232 … … 661 662 662 663 if( getenv( "BITLBEE_DEBUG" ) ) 663 printf("%p %s %d\n", bu, handle, bd->flags );664 fprintf( stderr, "%p %s %d\n", bu, handle, bd->flags ); 664 665 665 666 return XT_HANDLED; … … 808 809 809 810 if( getenv( "BITLBEE_DEBUG" ) ) 810 printf("%s %s\n", id, name );811 fprintf( stderr, "%s %s\n", id, name ); 811 812 812 813 return XT_HANDLED; … … 869 870 870 871 if( getenv( "BITLBEE_DEBUG" ) ) 871 printf("%s %s %s %s\n", id, type, handle, display_name );872 fprintf( stderr, "%s %s %s %s\n", id, type, handle, display_name ); 872 873 873 874 return XT_HANDLED; -
protocols/nogaim.c
r87dddee r6e9ae72 216 216 if( a ) 217 217 /* FIXME(wilmer): ui_log callback or so */ 218 irc_ usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );218 irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->tag, text ); 219 219 else 220 irc_ usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );220 irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); 221 221 222 222 g_free( text ); -
protocols/oscar/chat.c
r87dddee r6e9ae72 384 384 char *roomname = NULL; 385 385 struct aim_chat_roominfo roominfo; 386 guint16 tlvcount = 0;387 386 aim_tlvlist_t *tlvlist; 388 387 char *roomdesc = NULL; … … 401 400 } 402 401 403 tlvcount = aimbs_get16(bs);402 aimbs_get16(bs); /* tlv count */ 404 403 405 404 /* -
protocols/oscar/chatnav.c
r87dddee r6e9ae72 139 139 * Type 0x0002: Unknown 140 140 */ 141 if (aim_gettlv(innerlist, 0x0002, 1)) { 142 guint16 classperms; 143 144 classperms = aim_gettlv16(innerlist, 0x0002, 1); 145 146 } 141 if (aim_gettlv(innerlist, 0x0002, 1)) 142 ; 147 143 148 144 /* … … 205 201 */ 206 202 if (aim_gettlv(innerlist, 0x00d5, 1)) { 207 guint8 createperms; 208 209 createperms = aim_gettlv8(innerlist, 0x00d5, 1); 203 aim_gettlv8(innerlist, 0x00d5, 1); /* createperms */ 210 204 } 211 205 -
protocols/oscar/icq.c
r87dddee r6e9ae72 235 235 aim_tlv_t *datatlv; 236 236 aim_bstream_t qbs; 237 guint32 ouruin; 238 guint16 cmdlen, cmd, reqid; 237 guint16 cmd, reqid; 239 238 240 239 if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { … … 246 245 aim_bstream_init(&qbs, datatlv->value, datatlv->length); 247 246 248 cmdlen = aimbs_getle16(&qbs);249 ouruin = aimbs_getle32(&qbs);247 aimbs_getle16(&qbs); /* cmdlen */ 248 aimbs_getle32(&qbs); /* ouruin */ 250 249 cmd = aimbs_getle16(&qbs); 251 250 reqid = aimbs_getle16(&qbs); -
protocols/oscar/im.c
r87dddee r6e9ae72 919 919 int i, ret = 0; 920 920 aim_rxcallback_t userfunc; 921 guint8 cookie[8];922 921 guint16 channel; 923 922 aim_tlvlist_t *tlvlist; … … 931 930 /* ICBM Cookie. */ 932 931 for (i = 0; i < 8; i++) 933 cookie[i] =aimbs_get8(bs);932 aimbs_get8(bs); 934 933 935 934 /* Channel ID */ … … 1414 1413 { 1415 1414 guint16 hdrlen, msglen, dc; 1416 guint8 msgtype , msgflags;1415 guint8 msgtype; 1417 1416 guint8 *plugin; 1418 1417 int i = 0, tmp = 0; … … 1442 1441 1443 1442 msgtype = aimbs_getle8(servdata); 1444 msgflags = aimbs_getle8(servdata);1443 aimbs_getle8(servdata); /* msgflags */ 1445 1444 1446 1445 aim_bstream_advance(servdata, 0x04); /* status code and priority code */ -
protocols/oscar/misc.c
r87dddee r6e9ae72 310 310 { 311 311 aim_frame_t *fr; 312 aim_snacid_t snacid;313 312 aim_tlvlist_t *tl = NULL; 314 313 … … 330 329 return -ENOMEM; 331 330 332 snacid =aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);331 aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); 333 332 334 333 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); -
protocols/oscar/oscar.c
r87dddee r6e9ae72 1072 1072 static void gaim_icq_authgrant(void *data_) { 1073 1073 struct icq_auth *data = data_; 1074 char *uin , message;1074 char *uin; 1075 1075 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; 1076 1076 1077 1077 uin = g_strdup_printf("%u", data->uin); 1078 message = 0;1079 1078 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1079 // char *message = 0; 1080 1080 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1081 1081 imcb_ask_add(data->ic, uin, NULL); … … 1219 1219 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { 1220 1220 va_list ap; 1221 guint16 chan,nummissed, reason;1221 guint16 nummissed, reason; 1222 1222 aim_userinfo_t *userinfo; 1223 1223 1224 1224 va_start(ap, fr); 1225 chan = (guint16)va_arg(ap, unsigned int);1225 va_arg(ap, unsigned int); /* chan */ 1226 1226 userinfo = va_arg(ap, aim_userinfo_t *); 1227 1227 nummissed = (guint16)va_arg(ap, unsigned int); … … 1335 1335 1336 1336 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { 1337 char *msg;1338 1337 guint16 id; 1339 1338 va_list ap; … … 1341 1340 va_start(ap, fr); 1342 1341 id = (guint16)va_arg(ap, unsigned int); 1343 msg = va_arg(ap, char *);1342 va_arg(ap, char *); /* msg */ 1344 1343 va_end(ap); 1345 1344 … … 1361 1360 switch(type) { 1362 1361 case 0x0002: { 1363 guint8 maxrooms; 1364 struct aim_chat_exchangeinfo *exchanges; 1365 int exchangecount; // i; 1366 1367 maxrooms = (guint8)va_arg(ap, unsigned int); 1368 exchangecount = va_arg(ap, int); 1369 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); 1362 va_arg(ap, unsigned int); /* maxrooms */ 1363 va_arg(ap, int); /* exchangecount */ 1364 va_arg(ap, struct aim_chat_exchangeinfo *); /* exchanges */ 1370 1365 va_end(ap); 1371 1366 … … 1380 1375 break; 1381 1376 case 0x0008: { 1382 char *fqcn, *name, *ck; 1383 guint16 instance, flags, maxmsglen, maxoccupancy, unknown, exchange; 1384 guint8 createperms; 1385 guint32 createtime; 1386 1387 fqcn = va_arg(ap, char *); 1377 char *ck; 1378 guint16 instance, exchange; 1379 1380 va_arg(ap, char *); /* fqcn */ 1388 1381 instance = (guint16)va_arg(ap, unsigned int); 1389 1382 exchange = (guint16)va_arg(ap, unsigned int); 1390 flags = (guint16)va_arg(ap, unsigned int);1391 createtime = va_arg(ap, guint32);1392 maxmsglen = (guint16)va_arg(ap, unsigned int);1393 maxoccupancy = (guint16)va_arg(ap, unsigned int);1394 createperms = (guint8)va_arg(ap, int);1395 unknown = (guint16)va_arg(ap, unsigned int);1396 name = va_arg(ap, char *);1383 va_arg(ap, unsigned int); /* flags */ 1384 va_arg(ap, guint32); /* createtime */ 1385 va_arg(ap, unsigned int); /* maxmsglen */ 1386 va_arg(ap, unsigned int); /* maxoccupancy */ 1387 va_arg(ap, int); /* createperms */ 1388 va_arg(ap, unsigned int); /* unknown */ 1389 va_arg(ap, char *); /* name */ 1397 1390 ck = va_arg(ap, char *); 1398 1391 va_end(ap); … … 1456 1449 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { 1457 1450 va_list ap; 1458 aim_userinfo_t *userinfo; 1459 struct aim_chat_roominfo *roominfo; 1460 char *roomname; 1461 int usercount; 1462 char *roomdesc; 1463 guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; 1464 guint32 creationtime; 1451 guint16 maxmsglen, maxvisiblemsglen; 1465 1452 struct im_connection *ic = sess->aux_data; 1466 1453 struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn); 1467 1454 1468 1455 va_start(ap, fr); 1469 roominfo = va_arg(ap, struct aim_chat_roominfo *);1470 roomname = va_arg(ap, char *);1471 usercount= va_arg(ap, int);1472 userinfo = va_arg(ap, aim_userinfo_t *);1473 roomdesc = va_arg(ap, char *);1474 unknown_c9 = (guint16)va_arg(ap, int);1475 creationtime = (guint32)va_arg(ap, unsigned long);1456 va_arg(ap, struct aim_chat_roominfo *); /* roominfo */ 1457 va_arg(ap, char *); /* roomname */ 1458 va_arg(ap, int); /* usercount */ 1459 va_arg(ap, aim_userinfo_t *); /* userinfo */ 1460 va_arg(ap, char *); /* roomdesc */ 1461 va_arg(ap, int); /* unknown_c9 */ 1462 va_arg(ap, unsigned long); /* creationtime */ 1476 1463 maxmsglen = (guint16)va_arg(ap, int); 1477 unknown_d2 = (guint16)va_arg(ap, int);1478 unknown_d5 = (guint16)va_arg(ap, int);1464 va_arg(ap, int); /* unknown_d2 */ 1465 va_arg(ap, int); /* unknown_d5 */ 1479 1466 maxvisiblemsglen = (guint16)va_arg(ap, int); 1480 1467 va_end(ap); … … 1517 1504 #endif 1518 1505 va_list ap; 1519 guint16 code , rateclass;1520 guint32 windowsize, clear, alert, limit, disconnect, currentavg, maxavg;1506 guint16 code; 1507 guint32 windowsize, clear, currentavg; 1521 1508 1522 1509 va_start(ap, fr); 1523 1510 code = (guint16)va_arg(ap, unsigned int); 1524 rateclass= (guint16)va_arg(ap, unsigned int);1511 va_arg(ap, unsigned int); /* rateclass */ 1525 1512 windowsize = (guint32)va_arg(ap, unsigned long); 1526 1513 clear = (guint32)va_arg(ap, unsigned long); 1527 alert = (guint32)va_arg(ap, unsigned long);1528 limit = (guint32)va_arg(ap, unsigned long);1529 disconnect = (guint32)va_arg(ap, unsigned long);1514 va_arg(ap, unsigned long); /* alert */ 1515 va_arg(ap, unsigned long); /* limit */ 1516 va_arg(ap, unsigned long); /* disconnect */ 1530 1517 currentavg = (guint32)va_arg(ap, unsigned long); 1531 maxavg = (guint32)va_arg(ap, unsigned long);1518 va_arg(ap, unsigned long); /* maxavg */ 1532 1519 va_end(ap); 1533 1520 … … 2102 2089 aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); 2103 2090 } 2091 else if( st == 0x0A ) 2092 { 2093 imcb_error( sess->aux_data, "Buddy %s is already in your list", list ); 2094 } 2104 2095 else 2105 2096 { … … 2413 2404 struct im_connection * ic = sess->aux_data; 2414 2405 va_list ap; 2415 guint16 type 1, type2;2406 guint16 type2; 2416 2407 char * sn; 2417 2408 2418 2409 va_start(ap, fr); 2419 type1 = va_arg(ap, int);2410 va_arg(ap, int); /* type1 */ 2420 2411 sn = va_arg(ap, char*); 2421 2412 type2 = va_arg(ap, int); … … 2537 2528 2538 2529 if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { 2539 int st; 2540 2541 st = aim_chatnav_createroom(od->sess, cur, room, exchange_number); 2530 aim_chatnav_createroom(od->sess, cur, room, exchange_number); 2542 2531 2543 2532 return ret; … … 2566 2555 static int chat_id = 0; 2567 2556 char * chatname, *s; 2568 struct groupchat *c;2569 2557 2570 2558 chatname = g_strdup_printf("%s%s%d", isdigit(*ic->acc->user) ? "icq" : "", … … 2575 2563 *s = '0'; 2576 2564 2577 c = imcb_chat_new(ic, chatname);2578 2565 ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4); 2579 2566 aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0); … … 2581 2568 g_free(chatname); 2582 2569 2583 return NULL;2570 return ret; 2584 2571 } 2585 2572 -
protocols/oscar/rxqueue.c
r87dddee r6e9ae72 388 388 */ 389 389 if (aimbs_get8(&flaphdr) != 0x2a) { 390 guint8 start;391 392 390 aim_bstream_rewind(&flaphdr); 393 start =aimbs_get8(&flaphdr);391 aimbs_get8(&flaphdr); 394 392 imcb_error(sess->aux_data, "FLAP framing disrupted"); 395 393 aim_conn_close(conn); -
protocols/oscar/service.c
r87dddee r6e9ae72 563 563 groupcount = aimbs_get16(bs); 564 564 for (i = 0; i < groupcount; i++) { 565 guint16 group; 566 567 group = aimbs_get16(bs); 565 aimbs_get16(bs); 568 566 569 567 imcb_error(sess->aux_data, "bifurcated migration unsupported"); … … 701 699 static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 702 700 { 703 int vercount;704 701 guint8 *versions; 705 702 706 703 /* This is frivolous. (Thank you SmarterChild.) */ 707 vercount = aim_bstream_empty(bs)/4;704 aim_bstream_empty(bs); /* == vercount * 4 */ 708 705 versions = aimbs_getraw(bs, aim_bstream_empty(bs)); 709 706 g_free(versions); … … 731 728 aim_tlvlist_t *tl = NULL; 732 729 guint32 data; 733 int tlvlen;734 730 struct im_connection *ic = sess ? sess->aux_data : NULL; 735 731 … … 739 735 data |= AIM_ICQ_STATE_WEBAWARE; 740 736 741 tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);737 aim_addtlvtochain32(&tl, 0x0006, data); /* tlvlen */ 742 738 743 739 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) -
protocols/purple/purple.c
r87dddee r6e9ae72 181 181 /** No way to talk to the user right now, invent one when 182 182 this becomes important. 183 irc_ usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",183 irc_rootmsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n", 184 184 name, purple_account_option_get_type( o ) ); 185 185 */ … … 750 750 if( bud->server_alias ) 751 751 imcb_rename_buddy( ic, bud->name, bud->server_alias ); 752 else if( bud->alias ) 753 imcb_rename_buddy( ic, bud->name, bud->alias ); 752 754 753 755 if( group ) -
protocols/twitter/twitter.c
r87dddee r6e9ae72 30 30 31 31 #define twitter_msg( ic, fmt... ) \ 32 do { 33 struct twitter_data *td = ic->proto_data; 34 if( td-> home_timeline_gc )\35 imcb_chat_log( td-> home_timeline_gc, fmt );\36 else 37 imcb_log( ic, fmt ); 32 do { \ 33 struct twitter_data *td = ic->proto_data; \ 34 if( td->timeline_gc ) \ 35 imcb_chat_log( td->timeline_gc, fmt ); \ 36 else \ 37 imcb_log( ic, fmt ); \ 38 38 } while( 0 ); 39 39 … … 52 52 53 53 // Do stuff.. 54 twitter_get_ home_timeline(ic, -1);54 twitter_get_timeline(ic, -1); 55 55 56 56 // If we are still logged in run this function again after timeout. … … 69 69 // Queue the main_loop 70 70 // Save the return value, so we can remove the timeout on logout. 71 td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic); 71 td->main_loop_id = 72 b_timeout_add(set_getint(&ic->acc->set, "fetch_interval") * 1000, twitter_main_loop, ic); 72 73 } 73 74 … … 77 78 { 78 79 struct twitter_data *td = ic->proto_data; 80 81 td->flags &= ~TWITTER_DOING_TIMELINE; 79 82 80 83 if (set_getbool(&ic->acc->set, "oauth") && !td->oauth_info) … … 90 93 91 94 static const struct oauth_service twitter_oauth = { 92 "http ://api.twitter.com/oauth/request_token",93 "http ://api.twitter.com/oauth/access_token",95 "https://api.twitter.com/oauth/request_token", 96 "https://api.twitter.com/oauth/access_token", 94 97 "https://api.twitter.com/oauth/authorize", 95 98 .consumer_key = "xsDNKJuNZYkZyMcu914uEA", … … 98 101 99 102 static const struct oauth_service identica_oauth = { 100 "http ://identi.ca/api/oauth/request_token",101 "http ://identi.ca/api/oauth/access_token",103 "https://identi.ca/api/oauth/request_token", 104 "https://identi.ca/api/oauth/access_token", 102 105 "https://identi.ca/api/oauth/authorize", 103 106 .consumer_key = "e147ff789fcbd8a5a07963afbb43f9da", … … 216 219 def_oauth = "true"; 217 220 } else { /* if( strcmp( acc->prpl->name, "identica" ) == 0 ) */ 218 219 221 def_url = IDENTICA_API_URL; 220 222 def_oauth = "false"; … … 228 230 s = set_add(&acc->set, "commands", "true", set_eval_bool, acc); 229 231 232 s = set_add(&acc->set, "fetch_interval", "60", set_eval_int, acc); 233 s->flags |= ACC_SET_OFFLINE_ONLY; 234 235 s = set_add(&acc->set, "fetch_mentions", "true", set_eval_bool, acc); 236 230 237 s = set_add(&acc->set, "message_length", "140", set_eval_int, acc); 231 238 … … 235 242 s = set_add(&acc->set, "show_ids", "false", set_eval_bool, acc); 236 243 s->flags |= ACC_SET_OFFLINE_ONLY; 244 245 s = set_add(&acc->set, "show_old_mentions", "true", set_eval_bool, acc); 237 246 238 247 s = set_add(&acc->set, "oauth", def_oauth, set_eval_bool, acc); … … 317 326 b_event_remove(td->main_loop_id); 318 327 319 if (td-> home_timeline_gc)320 imcb_chat_free(td-> home_timeline_gc);328 if (td->timeline_gc) 329 imcb_chat_free(td->timeline_gc); 321 330 322 331 if (td) { … … 404 413 struct twitter_data *td = c->ic->proto_data; 405 414 406 if (c != td-> home_timeline_gc)415 if (c != td->timeline_gc) 407 416 return; /* WTF? */ 408 417 409 418 /* If the user leaves the channel: Fine. Rejoin him/her once new 410 419 tweets come in. */ 411 imcb_chat_free(td-> home_timeline_gc);412 td-> home_timeline_gc = NULL;420 imcb_chat_free(td->timeline_gc); 421 td->timeline_gc = NULL; 413 422 } 414 423 … … 465 474 guint64 id; 466 475 467 if (cmd[1]) 468 id = g_ascii_strtoull(cmd[1], NULL, 10); 469 else 470 id = td->last_status_id; 471 472 /* TODO: User feedback. */ 473 if (id) 476 if (cmd[1] == NULL) 477 twitter_status_destroy(ic, td->last_status_id); 478 else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1) { 479 if (id < TWITTER_LOG_LENGTH && td->log) 480 id = td->log[id].id; 481 474 482 twitter_status_destroy(ic, id); 475 else483 } else 476 484 twitter_msg(ic, "Could not undo last action"); 477 485 … … 491 499 guint64 id; 492 500 493 if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && 501 if (g_str_has_prefix(cmd[1], "#") && 502 sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1) { 503 if (id < TWITTER_LOG_LENGTH && td->log) 504 id = td->log[id].id; 505 } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && 494 506 (tud = bu->data) && tud->last_id) 495 507 id = tud->last_id; 496 else { 497 id = g_ascii_strtoull(cmd[1], NULL, 10); 508 else if (sscanf(cmd[1], "%" G_GUINT64_FORMAT, &id) == 1){ 498 509 if (id < TWITTER_LOG_LENGTH && td->log) 499 510 id = td->log[id].id; … … 514 525 guint64 id = 0; 515 526 516 if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && 527 if (g_str_has_prefix(cmd[1], "#") && 528 sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1 && 529 (id < TWITTER_LOG_LENGTH) && td->log) { 530 bu = td->log[id].bu; 531 if (g_slist_find(ic->bee->users, bu)) 532 id = td->log[id].id; 533 else 534 bu = NULL; 535 } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && 517 536 (tud = bu->data) && tud->last_id) { 518 537 id = tud->last_id; … … 525 544 bu = NULL; 526 545 } 546 527 547 if (!id || !bu) { 528 548 twitter_msg(ic, "User `%s' does not exist or didn't " -
protocols/twitter/twitter.h
r87dddee r6e9ae72 36 36 { 37 37 TWITTER_HAVE_FRIENDS = 1, 38 TWITTER_DOING_TIMELINE = 0x10000, 39 TWITTER_GOT_TIMELINE = 0x20000, 40 TWITTER_GOT_MENTIONS = 0x40000, 38 41 } twitter_flags_t; 39 42 … … 44 47 char* user; 45 48 struct oauth_info *oauth_info; 49 50 gpointer home_timeline_obj; 51 gpointer mentions_obj; 52 53 guint64 timeline_id; 54 46 55 GSList *follow_ids; 47 56 48 guint64 home_timeline_id;49 57 guint64 last_status_id; /* For undo */ 50 58 gint main_loop_id; 51 struct groupchat * home_timeline_gc;59 struct groupchat *timeline_gc; 52 60 gint http_fails; 53 61 twitter_flags_t flags; -
protocols/twitter/twitter_lib.c
r87dddee r6e9ae72 78 78 if (txu == NULL) 79 79 return; 80 80 81 g_free(txu->name); 81 82 g_free(txu->screen_name); … … 83 84 } 84 85 85 86 86 /** 87 87 * Frees a twitter_xml_status struct. … … 89 89 static void txs_free(struct twitter_xml_status *txs) 90 90 { 91 if (txs == NULL) 92 return; 93 91 94 g_free(txs->text); 92 95 txu_free(txs->user); … … 103 106 if (txl == NULL) 104 107 return; 105 for (l = txl->list; l; l = g_slist_next(l)) 106 if (txl->type == TXL_STATUS) 108 109 for (l = txl->list; l; l = g_slist_next(l)) { 110 if (txl->type == TXL_STATUS) { 107 111 txs_free((struct twitter_xml_status *) l->data); 108 else if (txl->type == TXL_ID)112 } else if (txl->type == TXL_ID) { 109 113 g_free(l->data); 110 else if (txl->type == TXL_USER)114 } else if (txl->type == TXL_USER) { 111 115 txu_free(l->data); 116 } 117 } 118 112 119 g_slist_free(txl->list); 113 120 g_free(txl); … … 115 122 116 123 /** 117 * Add a buddy if it is not allready added, set the status to logged in. 124 * Compare status elements 125 */ 126 static gint twitter_compare_elements(gconstpointer a, gconstpointer b) 127 { 128 struct twitter_xml_status *a_status = (struct twitter_xml_status *) a; 129 struct twitter_xml_status *b_status = (struct twitter_xml_status *) b; 130 131 if (a_status->created_at < b_status->created_at) { 132 return -1; 133 } else if (a_status->created_at > b_status->created_at) { 134 return 1; 135 } else { 136 return 0; 137 } 138 } 139 140 /** 141 * Add a buddy if it is not already added, set the status to logged in. 118 142 */ 119 143 static void twitter_add_buddy(struct im_connection *ic, char *name, const char *fullname) … … 132 156 exact Twitter username. */ 133 157 imcb_buddy_nick_hint(ic, name, name); 134 imcb_chat_add_buddy(td-> home_timeline_gc, name);158 imcb_chat_add_buddy(td->timeline_gc, name); 135 159 } else if (g_strcasecmp(mode, "many") == 0) 136 160 imcb_buddy_status(ic, name, OPT_LOGGED_IN, NULL, NULL); … … 260 284 261 285 /* Create the room now that we "logged in". */ 262 if (!td-> home_timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0)286 if (!td->timeline_gc && g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) 263 287 twitter_groupchat_init(ic); 264 288 … … 436 460 { 437 461 struct xt_node *child, *rt = NULL; 438 gboolean truncated = FALSE;439 462 440 463 // Walk over the nodes children. … … 442 465 if (g_strcasecmp("text", child->name) == 0) { 443 466 txs->text = g_memdup(child->text, child->text_len + 1); 444 } else if (g_strcasecmp("truncated", child->name) == 0 && child->text) {445 truncated = bool2int(child->text);446 467 } else if (g_strcasecmp("retweeted_status", child->name) == 0) { 447 468 rt = child; … … 464 485 } 465 486 466 /* If it's a truncated retweet, get the original because dots suck. */ 467 if (truncated && rt) { 487 /* If it's a (truncated) retweet, get the original. Even if the API claims it 488 wasn't truncated because it may be lying. */ 489 if (rt) { 468 490 struct twitter_xml_status *rtxs = g_new0(struct twitter_xml_status, 1); 469 491 if (twitter_xt_get_status(rt, rtxs) != XT_HANDLED) { … … 475 497 txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); 476 498 txs_free(rtxs); 499 } else { 500 struct xt_node *urls, *url; 501 502 urls = xt_find_path(node, "entities/urls"); 503 for (url = urls ? urls->children : NULL; url; url = url->next) { 504 /* "short" is a reserved word. :-P */ 505 struct xt_node *kort = xt_find_node(url->children, "url"); 506 struct xt_node *disp = xt_find_node(url->children, "display_url"); 507 char *pos, *new; 508 509 if (!kort || !kort->text || !disp || !disp->text || 510 !(pos = strstr(txs->text, kort->text))) 511 continue; 512 513 *pos = '\0'; 514 new = g_strdup_printf("%s%s <%s>%s", txs->text, kort->text, 515 disp->text, pos + strlen(kort->text)); 516 517 g_free(txs->text); 518 txs->text = new; 519 } 477 520 } 478 521 … … 520 563 521 564 return XT_HANDLED; 522 }523 524 static void twitter_http_get_home_timeline(struct http_request *req);525 526 /**527 * Get the timeline.528 */529 void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor)530 {531 struct twitter_data *td = ic->proto_data;532 533 char *args[4];534 args[0] = "cursor";535 args[1] = g_strdup_printf("%lld", (long long) next_cursor);536 if (td->home_timeline_id) {537 args[2] = "since_id";538 args[3] = g_strdup_printf("%llu", (long long unsigned int) td->home_timeline_id);539 }540 541 twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args,542 td->home_timeline_id ? 4 : 2);543 544 g_free(args[1]);545 if (td->home_timeline_id) {546 g_free(args[3]);547 }548 565 } 549 566 … … 586 603 GSList *l; 587 604 588 td-> home_timeline_gc = gc = imcb_chat_new(ic, "home/timeline");605 td->timeline_gc = gc = imcb_chat_new(ic, "twitter/timeline"); 589 606 590 607 name_hint = g_strdup_printf("%s_%s", td->prefix, ic->acc->user); … … 595 612 bee_user_t *bu = l->data; 596 613 if (bu->ic == ic) 597 imcb_chat_add_buddy(td-> home_timeline_gc, bu->handle);614 imcb_chat_add_buddy(td->timeline_gc, bu->handle); 598 615 } 599 616 } … … 608 625 struct twitter_xml_status *status; 609 626 struct groupchat *gc; 627 guint64 last_id = 0; 610 628 611 629 // Create a new groupchat if it does not exsist. 612 if (!td-> home_timeline_gc)630 if (!td->timeline_gc) 613 631 twitter_groupchat_init(ic); 614 632 615 gc = td-> home_timeline_gc;633 gc = td->timeline_gc; 616 634 if (!gc->joined) 617 635 imcb_chat_add_buddy(gc, ic->acc->user); … … 621 639 622 640 status = l->data; 623 if (status->user == NULL || status->text == NULL )641 if (status->user == NULL || status->text == NULL || last_id == status->id) 624 642 continue; 625 643 626 twitter_add_buddy(ic, status->user->screen_name, status->user->name);644 last_id = status->id; 627 645 628 646 strip_html(status->text); 647 629 648 msg = twitter_msg_add_id(ic, status, ""); 630 649 631 650 // Say it! 632 if (g_strcasecmp(td->user, status->user->screen_name) == 0) 651 if (g_strcasecmp(td->user, status->user->screen_name) == 0) { 633 652 imcb_chat_log(gc, "You: %s", msg ? msg : status->text); 634 else 653 } else { 654 twitter_add_buddy(ic, status->user->screen_name, status->user->name); 655 635 656 imcb_chat_msg(gc, status->user->screen_name, 636 657 msg ? msg : status->text, 0, status->created_at); 658 } 637 659 638 660 g_free(msg); 639 661 640 // Update the home_timeline_id to hold the highest id, so that by the next request662 // Update the timeline_id to hold the highest id, so that by the next request 641 663 // we won't pick up the updates already in the list. 642 td-> home_timeline_id = MAX(td->home_timeline_id, status->id);664 td->timeline_id = MAX(td->timeline_id, status->id); 643 665 } 644 666 } … … 654 676 char from[MAX_STRING]; 655 677 gboolean mode_one; 678 guint64 last_id = 0; 656 679 657 680 mode_one = g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "one") == 0; … … 666 689 667 690 status = l->data; 691 if (status->user == NULL || status->text == NULL || last_id == status->id) 692 continue; 693 694 last_id = status->id; 668 695 669 696 strip_html(status->text); … … 680 707 text ? text : status->text, 0, status->created_at); 681 708 682 // Update the home_timeline_id to hold the highest id, so that by the next request709 // Update the timeline_id to hold the highest id, so that by the next request 683 710 // we won't pick up the updates already in the list. 684 td-> home_timeline_id = MAX(td->home_timeline_id, status->id);711 td->timeline_id = MAX(td->timeline_id, status->id); 685 712 686 713 g_free(text); 687 714 g_free(prefix); 715 } 716 } 717 718 static void twitter_http_get_home_timeline(struct http_request *req); 719 static void twitter_http_get_mentions(struct http_request *req); 720 721 /** 722 * Get the timeline with optionally mentions 723 */ 724 void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor) 725 { 726 struct twitter_data *td = ic->proto_data; 727 gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); 728 729 if (td->flags & TWITTER_DOING_TIMELINE) { 730 return; 731 } 732 733 td->flags |= TWITTER_DOING_TIMELINE; 734 735 twitter_get_home_timeline(ic, next_cursor); 736 737 if (include_mentions) { 738 twitter_get_mentions(ic, next_cursor); 739 } 740 } 741 742 /** 743 * Call this one after receiving timeline/mentions. Show to user once we have 744 * both. 745 */ 746 void twitter_flush_timeline(struct im_connection *ic) 747 { 748 struct twitter_data *td = ic->proto_data; 749 gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions"); 750 gboolean show_old_mentions = set_getbool(&ic->acc->set, "show_old_mentions"); 751 struct twitter_xml_list *home_timeline = td->home_timeline_obj; 752 struct twitter_xml_list *mentions = td->mentions_obj; 753 GSList *output = NULL; 754 GSList *l; 755 756 if (!(td->flags & TWITTER_GOT_TIMELINE)) { 757 return; 758 } 759 760 if (include_mentions && !(td->flags & TWITTER_GOT_MENTIONS)) { 761 return; 762 } 763 764 if (home_timeline && home_timeline->list) { 765 for (l = home_timeline->list; l; l = g_slist_next(l)) { 766 output = g_slist_insert_sorted(output, l->data, twitter_compare_elements); 767 } 768 } 769 770 if (include_mentions && mentions && mentions->list) { 771 for (l = mentions->list; l; l = g_slist_next(l)) { 772 if (!show_old_mentions && output && twitter_compare_elements(l->data, output->data) < 0) { 773 continue; 774 } 775 776 output = g_slist_insert_sorted(output, l->data, twitter_compare_elements); 777 } 778 } 779 780 // See if the user wants to see the messages in a groupchat window or as private messages. 781 if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) 782 twitter_groupchat(ic, output); 783 else 784 twitter_private_message_chat(ic, output); 785 786 g_slist_free(output); 787 788 if (home_timeline && home_timeline->list) { 789 txl_free(home_timeline); 790 } 791 792 if (mentions && mentions->list) { 793 txl_free(mentions); 794 } 795 796 td->flags &= ~(TWITTER_DOING_TIMELINE | TWITTER_GOT_TIMELINE | TWITTER_GOT_MENTIONS); 797 } 798 799 /** 800 * Get the timeline. 801 */ 802 void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor) 803 { 804 struct twitter_data *td = ic->proto_data; 805 806 td->home_timeline_obj = NULL; 807 td->flags &= ~TWITTER_GOT_TIMELINE; 808 809 char *args[6]; 810 args[0] = "cursor"; 811 args[1] = g_strdup_printf("%lld", (long long) next_cursor); 812 args[2] = "include_entities"; 813 args[3] = "true"; 814 if (td->timeline_id) { 815 args[4] = "since_id"; 816 args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); 817 } 818 819 if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, 820 td->timeline_id ? 6 : 4) == NULL) { 821 if (++td->http_fails >= 5) 822 imcb_error(ic, "Could not retrieve %s: %s", 823 TWITTER_HOME_TIMELINE_URL, "connection failed"); 824 td->flags |= TWITTER_GOT_TIMELINE; 825 twitter_flush_timeline(ic); 826 } 827 828 g_free(args[1]); 829 if (td->timeline_id) { 830 g_free(args[5]); 831 } 832 } 833 834 /** 835 * Get mentions. 836 */ 837 void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor) 838 { 839 struct twitter_data *td = ic->proto_data; 840 841 td->mentions_obj = NULL; 842 td->flags &= ~TWITTER_GOT_MENTIONS; 843 844 char *args[6]; 845 args[0] = "cursor"; 846 args[1] = g_strdup_printf("%lld", (long long) next_cursor); 847 args[2] = "include_entities"; 848 args[3] = "true"; 849 if (td->timeline_id) { 850 args[4] = "since_id"; 851 args[5] = g_strdup_printf("%llu", (long long unsigned int) td->timeline_id); 852 } 853 854 if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args, 855 td->timeline_id ? 6 : 4) == NULL) { 856 if (++td->http_fails >= 5) 857 imcb_error(ic, "Could not retrieve %s: %s", 858 TWITTER_MENTIONS_URL, "connection failed"); 859 td->flags |= TWITTER_GOT_MENTIONS; 860 twitter_flush_timeline(ic); 861 } 862 863 g_free(args[1]); 864 if (td->timeline_id) { 865 g_free(args[5]); 688 866 } 689 867 } … … 713 891 imcb_error(ic, "Authentication failure"); 714 892 imc_logout(ic, FALSE); 715 return;893 goto end; 716 894 } else { 717 895 // It didn't go well, output the error and return. … … 720 898 TWITTER_HOME_TIMELINE_URL, twitter_parse_error(req)); 721 899 722 return;900 goto end; 723 901 } 724 902 … … 733 911 xt_free(parser); 734 912 735 // See if the user wants to see the messages in a groupchat window or as private messages. 736 if (txl->list == NULL); 737 else if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) 738 twitter_groupchat(ic, txl->list); 739 else 740 twitter_private_message_chat(ic, txl->list); 741 742 // Free the structure. 743 txl_free(txl); 913 td->home_timeline_obj = txl; 914 915 end: 916 td->flags |= TWITTER_GOT_TIMELINE; 917 918 twitter_flush_timeline(ic); 919 } 920 921 /** 922 * Callback for getting mentions. 923 */ 924 static void twitter_http_get_mentions(struct http_request *req) 925 { 926 struct im_connection *ic = req->data; 927 struct twitter_data *td; 928 struct xt_parser *parser; 929 struct twitter_xml_list *txl; 930 931 // Check if the connection is still active. 932 if (!g_slist_find(twitter_connections, ic)) 933 return; 934 935 td = ic->proto_data; 936 937 // Check if the HTTP request went well. 938 if (req->status_code == 200) { 939 td->http_fails = 0; 940 if (!(ic->flags & OPT_LOGGED_IN)) 941 imcb_connected(ic); 942 } else if (req->status_code == 401) { 943 imcb_error(ic, "Authentication failure"); 944 imc_logout(ic, FALSE); 945 goto end; 946 } else { 947 // It didn't go well, output the error and return. 948 if (++td->http_fails >= 5) 949 imcb_error(ic, "Could not retrieve %s: %s", 950 TWITTER_MENTIONS_URL, twitter_parse_error(req)); 951 952 goto end; 953 } 954 955 txl = g_new0(struct twitter_xml_list, 1); 956 txl->list = NULL; 957 958 // Parse the data. 959 parser = xt_new(NULL, txl); 960 xt_feed(parser, req->reply_body, req->body_size); 961 // The root <statuses> node should hold the list of statuses <status> 962 twitter_xt_get_status_list(ic, parser->root, txl); 963 xt_free(parser); 964 965 td->mentions_obj = txl; 966 967 end: 968 td->flags |= TWITTER_GOT_MENTIONS; 969 970 twitter_flush_timeline(ic); 744 971 } 745 972 -
protocols/twitter/twitter_lib.h
r87dddee r6e9ae72 76 76 #define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/" 77 77 78 void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor); 78 79 void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor); 79 80 void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor); 81 void twitter_get_mentions(struct im_connection *ic, gint64 next_cursor); 80 82 void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor); 81 83 -
protocols/yahoo/libyahoo2.c
r87dddee r6e9ae72 1809 1809 struct yahoo_input_data *yid = had->yid; 1810 1810 struct yahoo_data *yd = yid->yd; 1811 struct http_request *req;1812 1811 char *login, *passwd, *chal; 1813 1812 char *url; … … 1823 1822 (int) time(NULL), login, passwd, chal); 1824 1823 1825 req =http_dorequest_url(url, yahoo_https_auth_token_finish, had);1824 http_dorequest_url(url, yahoo_https_auth_token_finish, had); 1826 1825 1827 1826 g_free(url); … … 1870 1869 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had) 1871 1870 { 1872 struct http_request *req;1873 1871 char *url; 1874 1872 … … 1876 1874 (int) time(NULL), had->token); 1877 1875 1878 req =http_dorequest_url(url, yahoo_https_auth_finish, had);1876 http_dorequest_url(url, yahoo_https_auth_finish, had); 1879 1877 1880 1878 g_free(url); … … 1990 1988 { 1991 1989 struct yahoo_data *yd = yid->yd; 1992 char *login_id;1993 char *handle;1994 1990 char *url = NULL; 1995 1991 int login_status = -1; … … 2000 1996 struct yahoo_pair *pair = l->data; 2001 1997 if (pair->key == 0) 2002 login_id = pair->value;1998 ; /* login_id */ 2003 1999 else if (pair->key == 1) 2004 handle = pair->value;2000 ; /* handle */ 2005 2001 else if (pair->key == 20) 2006 2002 url = pair->value; … … 2089 2085 char *msg = NULL; 2090 2086 char *name = NULL; 2091 long tm = 0L;2092 2087 int state = YAHOO_STATUS_AVAILABLE; 2093 int online = 0;2094 2088 int away = 0; 2095 2089 int idle = 0; … … 2111 2105 state = strtol(pair->value, NULL, 10); 2112 2106 else if (pair->key == 15) 2113 tm = strtol(pair->value, NULL, 10);2107 ; /* tm */ 2114 2108 else if (pair->key == 13) 2115 online = strtol(pair->value, NULL, 10);2109 ; /* online */ 2116 2110 else if (pair->key == 47) 2117 2111 away = strtol(pair->value, NULL, 10); … … 2140 2134 char *where = NULL; 2141 2135 int status = 0; 2142 char *me = NULL;2143 2136 2144 2137 struct yahoo_buddy *bud = NULL; … … 2148 2141 struct yahoo_pair *pair = l->data; 2149 2142 if (pair->key == 1) 2150 me = pair->value;2143 ; /* Me... don't care */ 2151 2144 if (pair->key == 7) 2152 2145 who = pair->value; … … 2204 2197 char *who = NULL; 2205 2198 char *where = NULL; 2206 int unk_66 = 0;2207 char *me = NULL;2208 2199 struct yahoo_buddy *bud; 2209 2200 … … 2214 2205 struct yahoo_pair *pair = l->data; 2215 2206 if (pair->key == 1) 2216 me = pair->value;2207 ; /* Me... don't care */ 2217 2208 else if (pair->key == 7) 2218 2209 who = pair->value; … … 2220 2211 where = pair->value; 2221 2212 else if (pair->key == 66) 2222 unk_66 = strtol(pair->value, NULL, 10);2213 ; /* unk_66 */ 2223 2214 else 2224 2215 DEBUG_MSG(("unknown key: %d = %s", pair->key, … … 2256 2247 struct yahoo_packet *pkt) 2257 2248 { 2258 char *who = NULL;2259 int status = 0;2260 char *me = NULL;2261 int un_ignore = 0;2262 2263 2249 YList *l; 2264 2250 for (l = pkt->hash; l; l = l->next) { 2265 2251 struct yahoo_pair *pair = l->data; 2266 2252 if (pair->key == 0) 2267 who = pair->value;2253 ; /* who */ 2268 2254 if (pair->key == 1) 2269 me = pair->value;2255 ; /* Me... don't care */ 2270 2256 if (pair->key == 13) /* 1 == ignore, 2 == unignore */ 2271 un_ignore = strtol(pair->value, NULL, 10);2257 ; 2272 2258 if (pair->key == 66) 2273 status = strtol(pair->value, NULL, 10);2259 ; /* status */ 2274 2260 } 2275 2261 … … 2293 2279 char *me = NULL; 2294 2280 char *room = NULL; 2295 char *voice_room = NULL;2296 2281 2297 2282 YList *l; … … 2303 2288 me = pair->value; 2304 2289 if (pair->key == 13) 2305 voice_room = pair->value;2290 ; /* voice room */ 2306 2291 if (pair->key == 57) 2307 2292 room = pair->value; … … 2438 2423 struct yahoo_packet *pkt) 2439 2424 { 2440 char *me = NULL;2441 2425 char *key = NULL; 2442 2426 char *who = NULL; … … 2447 2431 struct yahoo_pair *pair = l->data; 2448 2432 if (pair->key == 5) 2449 me = pair->value;2433 ; /* me */ 2450 2434 if (pair->key == 61) 2451 2435 key = pair->value; … … 3369 3353 struct yahoo_webcam *wcm = y->wcm; 3370 3354 struct yahoo_input_data *yid; 3371 struct yahoo_server_settings *yss;3372 3355 3373 3356 if (!wcm || !wcm->server || !wcm->key) … … 3381 3364 yid->wcm = y->wcm; 3382 3365 y->wcm = NULL; 3383 3384 yss = y->yd->server_settings;3385 3366 3386 3367 yid->wcd = y_new0(struct yahoo_webcam_data, 1); … … 4975 4956 YList *l; 4976 4957 struct send_file_data *sfd; 4977 char *who = NULL;4978 char *filename = NULL;4979 4958 char *id = NULL; 4980 4959 char *token = NULL; … … 4984 4963 switch (pair->key) { 4985 4964 case 4: 4986 who = pair->value;4965 /* who */ 4987 4966 break; 4988 4967 case 5: … … 4998 4977 break; 4999 4978 case 27: 5000 filename = pair->value;4979 /* filename */ 5001 4980 break; 5002 4981 } … … 5023 5002 { 5024 5003 YList *l; 5025 char *who = NULL;5026 char *filename = NULL;5027 5004 char *id = NULL; 5028 5005 char *token = NULL; … … 5036 5013 case 1: 5037 5014 case 4: 5038 who = pair->value;5015 /* who */ 5039 5016 break; 5040 5017 case 5: … … 5053 5030 break; 5054 5031 case 27: 5055 filename = pair->value;5032 /* filename */ 5056 5033 break; 5057 5034 } -
query.c
r87dddee r6e9ae72 150 150 imcb_log( q->ic, "Accepted: %s", q->question ); 151 151 else 152 irc_ usermsg( irc, "Accepted: %s", q->question );152 irc_rootmsg( irc, "Accepted: %s", q->question ); 153 153 if( q->yes ) 154 154 q->yes( q->data ); … … 159 159 imcb_log( q->ic, "Rejected: %s", q->question ); 160 160 else 161 irc_ usermsg( irc, "Rejected: %s", q->question );161 irc_rootmsg( irc, "Rejected: %s", q->question ); 162 162 if( q->no ) 163 163 q->no( q->data ); … … 179 179 else 180 180 { 181 irc_ usermsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );181 irc_rootmsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question ); 182 182 } 183 183 } -
root_commands.c
r87dddee r6e9ae72 42 42 if( cmd[blaat] == NULL ) \ 43 43 { \ 44 irc_ usermsg( irc, "Not enough parameters given (need %d).", x ); \44 irc_rootmsg( irc, "Not enough parameters given (need %d).", x ); \ 45 45 return y; \ 46 46 } \ … … 69 69 } 70 70 71 irc_ usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );71 irc_rootmsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] ); 72 72 } 73 73 … … 90 90 if( s ) 91 91 { 92 irc_ usermsg( irc, "%s", s );92 irc_rootmsg( irc, "%s", s ); 93 93 g_free( s ); 94 94 } 95 95 else 96 96 { 97 irc_ usermsg( irc, "Error opening helpfile." );97 irc_rootmsg( irc, "Error opening helpfile." ); 98 98 } 99 99 } … … 110 110 if( irc->status & USTATUS_IDENTIFIED ) 111 111 { 112 irc_ usermsg( irc, "You're already logged in." );112 irc_rootmsg( irc, "You're already logged in." ); 113 113 return; 114 114 } … … 128 128 else if( irc->b->accounts != NULL ) 129 129 { 130 irc_ usermsg( irc,130 irc_rootmsg( irc, 131 131 "You're trying to identify yourself, but already have " 132 132 "at least one IM account set up. " … … 138 138 if( password == NULL ) 139 139 { 140 irc_ usermsg( irc, "About to identify, use /OPER to enter the password" );140 irc_rootmsg( irc, "About to identify, use /OPER to enter the password" ); 141 141 irc->status |= OPER_HACK_IDENTIFY; 142 142 return; … … 150 150 switch (status) { 151 151 case STORAGE_INVALID_PASSWORD: 152 irc_ usermsg( irc, "Incorrect password" );152 irc_rootmsg( irc, "Incorrect password" ); 153 153 break; 154 154 case STORAGE_NO_SUCH_USER: 155 irc_ usermsg( irc, "The nick is (probably) not registered" );155 irc_rootmsg( irc, "The nick is (probably) not registered" ); 156 156 break; 157 157 case STORAGE_OK: 158 irc_ usermsg( irc, "Password accepted%s",158 irc_rootmsg( irc, "Password accepted%s", 159 159 load ? ", settings and accounts loaded" : "" ); 160 160 irc_setpass( irc, password ); … … 192 192 case STORAGE_OTHER_ERROR: 193 193 default: 194 irc_ usermsg( irc, "Unknown error while loading configuration" );194 irc_rootmsg( irc, "Unknown error while loading configuration" ); 195 195 break; 196 196 } … … 215 215 if( global.conf->authmode == AUTHMODE_REGISTERED ) 216 216 { 217 irc_ usermsg( irc, "This server does not allow registering new accounts" );217 irc_rootmsg( irc, "This server does not allow registering new accounts" ); 218 218 return; 219 219 } … … 221 221 if( cmd[1] == NULL ) 222 222 { 223 irc_ usermsg( irc, "About to register, use /OPER to enter the password" );223 irc_rootmsg( irc, "About to register, use /OPER to enter the password" ); 224 224 irc->status |= OPER_HACK_REGISTER; 225 225 return; … … 228 228 switch( storage_save( irc, cmd[1], FALSE ) ) { 229 229 case STORAGE_ALREADY_EXISTS: 230 irc_ usermsg( irc, "Nick is already registered" );230 irc_rootmsg( irc, "Nick is already registered" ); 231 231 break; 232 232 233 233 case STORAGE_OK: 234 irc_ usermsg( irc, "Account successfully created" );234 irc_rootmsg( irc, "Account successfully created" ); 235 235 irc_setpass( irc, cmd[1] ); 236 236 irc->status |= USTATUS_IDENTIFIED; … … 245 245 246 246 default: 247 irc_ usermsg( irc, "Error registering" );247 irc_rootmsg( irc, "Error registering" ); 248 248 break; 249 249 } … … 257 257 switch (status) { 258 258 case STORAGE_NO_SUCH_USER: 259 irc_ usermsg( irc, "That account does not exist" );259 irc_rootmsg( irc, "That account does not exist" ); 260 260 break; 261 261 case STORAGE_INVALID_PASSWORD: 262 irc_ usermsg( irc, "Password invalid" );262 irc_rootmsg( irc, "Password invalid" ); 263 263 break; 264 264 case STORAGE_OK: … … 266 266 irc->status &= ~USTATUS_IDENTIFIED; 267 267 irc_umode_set( irc, "-R", 1 ); 268 irc_ usermsg( irc, "Account `%s' removed", irc->user->nick );268 irc_rootmsg( irc, "Account `%s' removed", irc->user->nick ); 269 269 break; 270 270 default: 271 irc_ usermsg( irc, "Error: `%d'", status );271 irc_rootmsg( irc, "Error: `%d'", status ); 272 272 break; 273 273 } … … 277 277 { 278 278 if( ( irc->status & USTATUS_IDENTIFIED ) == 0 ) 279 irc_ usermsg( irc, "Please create an account first" );279 irc_rootmsg( irc, "Please create an account first" ); 280 280 else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK ) 281 irc_ usermsg( irc, "Configuration saved" );282 else 283 irc_ usermsg( irc, "Configuration could not be saved!" );281 irc_rootmsg( irc, "Configuration saved" ); 282 else 283 irc_rootmsg( irc, "Configuration could not be saved!" ); 284 284 } 285 285 … … 290 290 291 291 if( ( val = set_getstr( head, key ) ) ) 292 irc_ usermsg( irc, "%s = `%s'", key, val );292 irc_rootmsg( irc, "%s = `%s'", key, val ); 293 293 else if( !( set = set_find( head, key ) ) ) 294 294 { 295 irc_ usermsg( irc, "Setting `%s' does not exist.", key );295 irc_rootmsg( irc, "Setting `%s' does not exist.", key ); 296 296 if( *head == irc->b->set ) 297 irc_ usermsg( irc, "It might be an account or channel setting. "297 irc_rootmsg( irc, "It might be an account or channel setting. " 298 298 "See \x02help account set\x02 and \x02help channel set\x02." ); 299 299 } 300 300 else if( set->flags & SET_PASSWORD ) 301 irc_ usermsg( irc, "%s = `********' (hidden)", key );302 else 303 irc_ usermsg( irc, "%s is empty", key );301 irc_rootmsg( irc, "%s = `********' (hidden)", key ); 302 else 303 irc_rootmsg( irc, "%s is empty", key ); 304 304 } 305 305 … … 344 344 feedback. */ 345 345 if( st ) 346 irc_ usermsg( irc, "Setting changed successfully" );346 irc_rootmsg( irc, "Setting changed successfully" ); 347 347 else 348 irc_ usermsg( irc, "Failed to change setting" );348 irc_rootmsg( irc, "Failed to change setting" ); 349 349 } 350 350 else … … 362 362 while( s ) 363 363 { 364 if( !( s->flags & SET_HIDDEN) )364 if( set_isvisible( s ) ) 365 365 cmd_showset( irc, &s, s->key ); 366 366 s = s->next; … … 377 377 if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY ) 378 378 { 379 irc_ usermsg( irc, "This setting can only be changed when the account is %s-line", "off" );379 irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "off" ); 380 380 return 0; 381 381 } 382 382 else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY ) 383 383 { 384 irc_ usermsg( irc, "This setting can only be changed when the account is %s-line", "on" );384 irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "on" ); 385 385 return 0; 386 386 } … … 396 396 if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) ) 397 397 { 398 irc_ usermsg( irc, "This server only accepts registered users" );398 irc_rootmsg( irc, "This server only accepts registered users" ); 399 399 return; 400 400 } … … 413 413 if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 414 414 { 415 irc_ usermsg( irc, "Enter password for account %s(%s)"416 "first (use /OPER)", a-> prpl->name, a->user);415 irc_rootmsg( irc, "Enter password for account %s " 416 "first (use /OPER)", a->tag ); 417 417 return; 418 418 } … … 425 425 if( prpl == NULL ) 426 426 { 427 irc_ usermsg( irc, "Unknown protocol" );427 irc_rootmsg( irc, "Unknown protocol" ); 428 428 return; 429 429 } … … 431 431 for( a = irc->b->accounts; a; a = a->next ) 432 432 if( a->prpl == prpl && prpl->handle_cmp( a->user, cmd[3] ) == 0 ) 433 irc_ usermsg( irc, "Warning: You already have an account with "433 irc_rootmsg( irc, "Warning: You already have an account with " 434 434 "protocol `%s' and username `%s'. Are you accidentally " 435 435 "trying to add it twice?", prpl->name, cmd[3] ); … … 438 438 if( cmd[5] ) 439 439 { 440 irc_ usermsg( irc, "Warning: Passing a servername/other flags to `account add' "440 irc_rootmsg( irc, "Warning: Passing a servername/other flags to `account add' " 441 441 "is now deprecated. Use `account set' instead." ); 442 442 set_setstr( &a->set, "server", cmd[5] ); 443 443 } 444 444 445 irc_usermsg( irc, "Account successfully added%s", cmd[4] ? "" : 445 irc_rootmsg( irc, "Account successfully added with tag %s%s", 446 a->tag, cmd[4] ? "" : 446 447 ", now use /OPER to enter the password" ); 447 448 … … 453 454 454 455 if( strchr( irc->umode, 'b' ) ) 455 irc_ usermsg( irc, "Account list:" );456 irc_rootmsg( irc, "Account list:" ); 456 457 457 458 for( a = irc->b->accounts; a; a = a->next ) … … 468 469 con = ""; 469 470 470 irc_ usermsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );471 irc_rootmsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con ); 471 472 472 473 i ++; 473 474 } 474 irc_ usermsg( irc, "End of account list" );475 irc_rootmsg( irc, "End of account list" ); 475 476 476 477 return; … … 484 485 if ( irc->b->accounts ) 485 486 { 486 irc_ usermsg( irc, "Trying to get all accounts connected..." );487 irc_rootmsg( irc, "Trying to get all accounts connected..." ); 487 488 488 489 for( a = irc->b->accounts; a; a = a->next ) … … 490 491 { 491 492 if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 492 irc_ usermsg( irc, "Enter password for account %s(%s)"493 "first (use /OPER)", a-> prpl->name, a->user);493 irc_rootmsg( irc, "Enter password for account %s " 494 "first (use /OPER)", a->tag ); 494 495 else 495 496 account_on( irc->b, a ); … … 498 499 else 499 500 { 500 irc_ usermsg( irc, "No accounts known. Use `account add' to add one." );501 irc_rootmsg( irc, "No accounts known. Use `account add' to add one." ); 501 502 } 502 503 … … 505 506 else if( len >= 2 && g_strncasecmp( cmd[1], "off", len ) == 0 ) 506 507 { 507 irc_ usermsg( irc, "Deactivating all active (re)connections..." );508 irc_rootmsg( irc, "Deactivating all active (re)connections..." ); 508 509 509 510 for( a = irc->b->accounts; a; a = a->next ) … … 530 531 ( a = account_get( irc->b, cmd[1] ) ) == NULL ) 531 532 { 532 irc_ usermsg( irc, "Could not find account `%s'. Note that the syntax "533 irc_rootmsg( irc, "Could not find account `%s'. Note that the syntax " 533 534 "of the account command changed, see \x02help account\x02.", cmd[1] ); 534 535 … … 540 541 if( a->ic ) 541 542 { 542 irc_ usermsg( irc, "Account is still logged in, can't delete" );543 irc_rootmsg( irc, "Account is still logged in, can't delete" ); 543 544 } 544 545 else 545 546 { 546 547 account_del( irc->b, a ); 547 irc_ usermsg( irc, "Account deleted" );548 irc_rootmsg( irc, "Account deleted" ); 548 549 } 549 550 } … … 551 552 { 552 553 if( a->ic ) 553 irc_ usermsg( irc, "Account already online" );554 irc_rootmsg( irc, "Account already online" ); 554 555 else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 555 irc_ usermsg( irc, "Enter password for account %s(%s)"556 "first (use /OPER)", a-> prpl->name, a->user);556 irc_rootmsg( irc, "Enter password for account %s " 557 "first (use /OPER)", a->tag ); 557 558 else 558 559 account_on( irc->b, a ); … … 567 568 { 568 569 cancel_auto_reconnect( a ); 569 irc_ usermsg( irc, "Reconnect cancelled" );570 } 571 else 572 { 573 irc_ usermsg( irc, "Account already offline" );570 irc_rootmsg( irc, "Reconnect cancelled" ); 571 } 572 else 573 { 574 irc_rootmsg( irc, "Account already offline" ); 574 575 } 575 576 } … … 580 581 else 581 582 { 582 irc_ usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );583 irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] ); 583 584 } 584 585 } … … 597 598 598 599 if( strchr( irc->umode, 'b' ) ) 599 irc_ usermsg( irc, "Channel list:" );600 irc_rootmsg( irc, "Channel list:" ); 600 601 601 602 for( l = irc->channels; l; l = l->next ) … … 603 604 irc_channel_t *ic = l->data; 604 605 605 irc_ usermsg( irc, "%2d. %s, %s channel%s", i, ic->name,606 irc_rootmsg( irc, "%2d. %s, %s channel%s", i, ic->name, 606 607 set_getstr( &ic->set, "type" ), 607 608 ic->flags & IRC_CHANNEL_JOINED ? " (joined)" : "" ); … … 609 610 i ++; 610 611 } 611 irc_ usermsg( irc, "End of channel list" );612 irc_rootmsg( irc, "End of channel list" ); 612 613 613 614 return; … … 623 624 cmd_set_real( irc, cmd + 1, &ic->set, NULL ); 624 625 else 625 irc_ usermsg( irc, "Could not find channel `%s'", cmd[1] );626 irc_rootmsg( irc, "Could not find channel `%s'", cmd[1] ); 626 627 627 628 return; … … 640 641 ic != ic->irc->default_channel ) 641 642 { 642 irc_ usermsg( irc, "Channel %s deleted.", ic->name );643 irc_rootmsg( irc, "Channel %s deleted.", ic->name ); 643 644 irc_channel_free( ic ); 644 645 } 645 646 else 646 irc_ usermsg( irc, "Couldn't remove channel (main channel %s or "647 irc_rootmsg( irc, "Couldn't remove channel (main channel %s or " 647 648 "channels you're still in cannot be deleted).", 648 649 irc->default_channel->name ); … … 650 651 else 651 652 { 652 irc_ usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );653 irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] ); 653 654 } 654 655 } … … 668 669 if( !( a = account_get( irc->b, cmd[1] ) ) ) 669 670 { 670 irc_ usermsg( irc, "Invalid account" );671 irc_rootmsg( irc, "Invalid account" ); 671 672 return; 672 673 } 673 674 else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 674 675 { 675 irc_ usermsg( irc, "That account is not on-line" );676 irc_rootmsg( irc, "That account is not on-line" ); 676 677 return; 677 678 } … … 681 682 if( !nick_ok( cmd[3] ) ) 682 683 { 683 irc_ usermsg( irc, "The requested nick `%s' is invalid", cmd[3] );684 irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] ); 684 685 return; 685 686 } 686 687 else if( irc_user_by_name( irc, cmd[3] ) ) 687 688 { 688 irc_ usermsg( irc, "The requested nick `%s' already exists", cmd[3] );689 irc_rootmsg( irc, "The requested nick `%s' already exists", cmd[3] ); 689 690 return; 690 691 } … … 704 705 strcmp( s, "group" ) == 0 && 705 706 ( group = set_getstr( &ic->set, "group" ) ) ) 706 irc_ usermsg( irc, "Adding `%s' to contact list (group %s)",707 irc_rootmsg( irc, "Adding `%s' to contact list (group %s)", 707 708 cmd[2], group ); 708 709 else 709 irc_ usermsg( irc, "Adding `%s' to contact list", cmd[2] );710 irc_rootmsg( irc, "Adding `%s' to contact list", cmd[2] ); 710 711 711 712 a->prpl->add_buddy( a->ic, cmd[2], group ); … … 720 721 if( ( bu = bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ) ) && 721 722 ( iu = bu->ui_data ) ) 722 irc_ usermsg( irc, "Temporarily assigned nickname `%s' "723 irc_rootmsg( irc, "Temporarily assigned nickname `%s' " 723 724 "to contact `%s'", iu->nick, cmd[2] ); 724 725 } … … 734 735 if( !( iu = irc_user_by_name( irc, cmd[1] ) ) || !( bu = iu->bu ) ) 735 736 { 736 irc_ usermsg( irc, "Buddy `%s' not found", cmd[1] );737 irc_rootmsg( irc, "Buddy `%s' not found", cmd[1] ); 737 738 return; 738 739 } … … 744 745 bee_user_free( irc->b, bu ); 745 746 746 irc_ usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );747 irc_rootmsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] ); 747 748 g_free( s ); 748 749 … … 760 761 if( !iu || !iu->bu ) 761 762 { 762 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );763 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 763 764 return; 764 765 } … … 768 769 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 769 770 { 770 irc_ usermsg( irc, "Invalid account" );771 irc_rootmsg( irc, "Invalid account" ); 771 772 return; 772 773 } 773 774 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 774 775 { 775 irc_ usermsg( irc, "That account is not on-line" );776 irc_rootmsg( irc, "That account is not on-line" ); 776 777 return; 777 778 } … … 779 780 if( !ic->acc->prpl->get_info ) 780 781 { 781 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );782 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 782 783 } 783 784 else … … 796 797 if( iu == NULL ) 797 798 { 798 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );799 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 799 800 } 800 801 else if( del ) … … 802 803 if( iu->bu ) 803 804 bee_irc_user_nick_reset( iu ); 804 irc_ usermsg( irc, "Nickname reset to `%s'", iu->nick );805 irc_rootmsg( irc, "Nickname reset to `%s'", iu->nick ); 805 806 } 806 807 else if( iu == irc->user ) 807 808 { 808 irc_ usermsg( irc, "Use /nick to change your own nickname" );809 irc_rootmsg( irc, "Use /nick to change your own nickname" ); 809 810 } 810 811 else if( !nick_ok( cmd[2] ) ) 811 812 { 812 irc_ usermsg( irc, "Nick `%s' is invalid", cmd[2] );813 irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] ); 813 814 } 814 815 else if( ( old = irc_user_by_name( irc, cmd[2] ) ) && old != iu ) 815 816 { 816 irc_ usermsg( irc, "Nick `%s' already exists", cmd[2] );817 irc_rootmsg( irc, "Nick `%s' already exists", cmd[2] ); 817 818 } 818 819 else … … 820 821 if( !irc_user_set_nick( iu, cmd[2] ) ) 821 822 { 822 irc_ usermsg( irc, "Error while changing nick" );823 irc_rootmsg( irc, "Error while changing nick" ); 823 824 return; 824 825 } … … 836 837 } 837 838 838 irc_ usermsg( irc, "Nick successfully changed" );839 irc_rootmsg( irc, "Nick successfully changed" ); 839 840 } 840 841 } … … 869 870 format = "%-32.32s %-16.16s"; 870 871 871 irc_ usermsg( irc, format, "Handle", "Nickname" );872 irc_rootmsg( irc, format, "Handle", "Nickname" ); 872 873 for( l = a->ic->deny; l; l = l->next ) 873 874 { 874 875 bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); 875 876 irc_user_t *iu = bu ? bu->ui_data : NULL; 876 irc_ usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );877 } 878 irc_ usermsg( irc, "End of list." );877 irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" ); 878 } 879 irc_rootmsg( irc, "End of list." ); 879 880 880 881 return; … … 885 886 if( !iu || !iu->bu ) 886 887 { 887 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );888 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 888 889 return; 889 890 } … … 893 894 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 894 895 { 895 irc_ usermsg( irc, "Invalid account" );896 irc_rootmsg( irc, "Invalid account" ); 896 897 return; 897 898 } 898 899 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 899 900 { 900 irc_ usermsg( irc, "That account is not on-line" );901 irc_rootmsg( irc, "That account is not on-line" ); 901 902 return; 902 903 } … … 904 905 if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit ) 905 906 { 906 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );907 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 907 908 } 908 909 else … … 910 911 imc_rem_allow( ic, cmd[2] ); 911 912 imc_add_block( ic, cmd[2] ); 912 irc_ usermsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );913 irc_rootmsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] ); 913 914 } 914 915 } … … 929 930 format = "%-32.32s %-16.16s"; 930 931 931 irc_ usermsg( irc, format, "Handle", "Nickname" );932 irc_rootmsg( irc, format, "Handle", "Nickname" ); 932 933 for( l = a->ic->permit; l; l = l->next ) 933 934 { 934 935 bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); 935 936 irc_user_t *iu = bu ? bu->ui_data : NULL; 936 irc_ usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );937 } 938 irc_ usermsg( irc, "End of list." );937 irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" ); 938 } 939 irc_rootmsg( irc, "End of list." ); 939 940 940 941 return; … … 945 946 if( !iu || !iu->bu ) 946 947 { 947 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );948 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 948 949 return; 949 950 } … … 953 954 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 954 955 { 955 irc_ usermsg( irc, "Invalid account" );956 irc_rootmsg( irc, "Invalid account" ); 956 957 return; 957 958 } 958 959 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 959 960 { 960 irc_ usermsg( irc, "That account is not on-line" );961 irc_rootmsg( irc, "That account is not on-line" ); 961 962 return; 962 963 } … … 964 965 if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit ) 965 966 { 966 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );967 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 967 968 } 968 969 else … … 971 972 imc_add_allow( ic, cmd[2] ); 972 973 973 irc_ usermsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );974 irc_rootmsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] ); 974 975 } 975 976 } … … 998 999 if( ( ++times >= 3 ) ) 999 1000 { 1000 irc_ usermsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );1001 irc_rootmsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] ); 1001 1002 last_irc = NULL; 1002 1003 times = 0; … … 1011 1012 } 1012 1013 1013 irc_ usermsg( irc, "Did I ask you something?" );1014 irc_rootmsg( irc, "Did I ask you something?" ); 1014 1015 return; 1015 1016 } … … 1021 1022 if( sscanf( cmd[1], "%d", &numq ) != 1 ) 1022 1023 { 1023 irc_ usermsg( irc, "Invalid query number" );1024 irc_rootmsg( irc, "Invalid query number" ); 1024 1025 return; 1025 1026 } … … 1031 1032 if( !q ) 1032 1033 { 1033 irc_ usermsg( irc, "Uhm, I never asked you something like that..." );1034 irc_rootmsg( irc, "Uhm, I never asked you something like that..." ); 1034 1035 return; 1035 1036 } … … 1071 1072 format = "%-16.16s %-40.40s %s"; 1072 1073 1073 irc_ usermsg( irc, format, "Nick", "Handle/Account", "Status" );1074 irc_rootmsg( irc, format, "Nick", "Handle/Account", "Status" ); 1074 1075 1075 1076 if( irc->root->last_channel && … … 1093 1094 g_snprintf( st, sizeof( st ) - 1, "Online (%s)", bu->status_msg ); 1094 1095 1095 g_snprintf( s, sizeof( s ) - 1, "%s %s (%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user);1096 irc_ usermsg( irc, format, iu->nick, s, st );1096 g_snprintf( s, sizeof( s ) - 1, "%s %s", bu->handle, bu->ic->acc->tag ); 1097 irc_rootmsg( irc, format, iu->nick, s, st ); 1097 1098 } 1098 1099 … … 1111 1112 if( away == 1 ) 1112 1113 { 1113 g_snprintf( s, sizeof( s ) - 1, "%s %s (%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user);1114 irc_ usermsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );1114 g_snprintf( s, sizeof( s ) - 1, "%s %s", bu->handle, bu->ic->acc->tag ); 1115 irc_rootmsg( irc, format, iu->nick, s, irc_user_get_away( iu ) ); 1115 1116 } 1116 1117 n_away ++; … … 1128 1129 if( offline == 1 ) 1129 1130 { 1130 g_snprintf( s, sizeof( s ) - 1, "%s %s (%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user);1131 irc_ usermsg( irc, format, iu->nick, s, "Offline" );1131 g_snprintf( s, sizeof( s ) - 1, "%s %s", bu->handle, bu->ic->acc->tag ); 1132 irc_rootmsg( irc, format, iu->nick, s, "Offline" ); 1132 1133 } 1133 1134 n_offline ++; 1134 1135 } 1135 1136 1136 irc_ usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );1137 irc_rootmsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline ); 1137 1138 } 1138 1139 … … 1144 1145 if( !q ) 1145 1146 { 1146 irc_ usermsg( irc, "There are no pending questions." );1147 return; 1148 } 1149 1150 irc_ usermsg( irc, "Pending queries:" );1147 irc_rootmsg( irc, "There are no pending questions." ); 1148 return; 1149 } 1150 1151 irc_rootmsg( irc, "Pending queries:" ); 1151 1152 1152 1153 for( num = 0; q; q = q->next, num ++ ) 1153 1154 if( q->ic ) /* Not necessary yet, but it might come later */ 1154 irc_ usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );1155 else 1156 irc_ usermsg( irc, "%d, BitlBee: %s", num, q->question );1155 irc_rootmsg( irc, "%d, %s: %s", num, q->ic->acc->tag, q->question ); 1156 else 1157 irc_rootmsg( irc, "%d, BitlBee: %s", num, q->question ); 1157 1158 } 1158 1159 … … 1170 1171 if( !( acc = account_get( irc->b, cmd[2] ) ) ) 1171 1172 { 1172 irc_ usermsg( irc, "Invalid account" );1173 irc_rootmsg( irc, "Invalid account" ); 1173 1174 return; 1174 1175 } 1175 1176 else if( !acc->prpl->chat_join ) 1176 1177 { 1177 irc_ usermsg( irc, "Named chatrooms not supported on that account." );1178 irc_rootmsg( irc, "Named chatrooms not supported on that account." ); 1178 1179 return; 1179 1180 } … … 1205 1206 set_setstr( &ic->set, "room", cmd[3] ) ) 1206 1207 { 1207 irc_ usermsg( irc, "Chatroom successfully added." );1208 irc_rootmsg( irc, "Chatroom successfully added." ); 1208 1209 } 1209 1210 else … … 1212 1213 irc_channel_free( ic ); 1213 1214 1214 irc_ usermsg( irc, "Could not add chatroom." );1215 irc_rootmsg( irc, "Could not add chatroom." ); 1215 1216 } 1216 1217 g_free( channel ); … … 1227 1228 if( !iu->bu->ic->acc->prpl->chat_with( iu->bu->ic, iu->bu->handle ) ) 1228 1229 { 1229 irc_ usermsg( irc, "(Possible) failure while trying to open "1230 irc_rootmsg( irc, "(Possible) failure while trying to open " 1230 1231 "a groupchat with %s.", iu->nick ); 1231 1232 } … … 1233 1234 else 1234 1235 { 1235 irc_ usermsg( irc, "Can't open a groupchat with %s.", cmd[2] );1236 irc_rootmsg( irc, "Can't open a groupchat with %s.", cmd[2] ); 1236 1237 } 1237 1238 } … … 1240 1241 g_strcasecmp( cmd[1], "del" ) == 0 ) 1241 1242 { 1242 irc_ usermsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );1243 irc_rootmsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." ); 1243 1244 cmd_channel( irc, cmd ); 1244 1245 } 1245 1246 else 1246 1247 { 1247 irc_ usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );1248 irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); 1248 1249 } 1249 1250 } … … 1260 1261 1261 1262 if( strchr( irc->umode, 'b' ) ) 1262 irc_ usermsg( irc, "Group list:" );1263 irc_rootmsg( irc, "Group list:" ); 1263 1264 1264 1265 for( l = irc->b->groups; l; l = l->next ) 1265 1266 { 1266 1267 bee_group_t *bg = l->data; 1267 irc_ usermsg( irc, "%d. %s", n ++, bg->name );1268 } 1269 irc_ usermsg( irc, "End of group list" );1270 } 1271 else 1272 { 1273 irc_ usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );1268 irc_rootmsg( irc, "%d. %s", n ++, bg->name ); 1269 } 1270 irc_rootmsg( irc, "End of group list" ); 1271 } 1272 else 1273 { 1274 irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] ); 1274 1275 } 1275 1276 } … … 1284 1285 if( !files ) 1285 1286 { 1286 irc_ usermsg( irc, "No pending transfers" );1287 irc_rootmsg( irc, "No pending transfers" ); 1287 1288 return; 1288 1289 } … … 1305 1306 case LIST: 1306 1307 if ( file->status == FT_STATUS_LISTENING ) 1307 irc_ usermsg( irc,1308 irc_rootmsg( irc, 1308 1309 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name); 1309 1310 else … … 1314 1315 kb_per_s = file->bytes_transferred / 1024 / diff; 1315 1316 1316 irc_ usermsg( irc,1317 irc_rootmsg( irc, 1317 1318 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name, 1318 1319 file->bytes_transferred/1024, file->file_size/1024, kb_per_s); … … 1322 1323 if( file->status == FT_STATUS_LISTENING ) 1323 1324 { 1324 irc_ usermsg( irc, "Rejecting file transfer for %s", file->file_name );1325 irc_rootmsg( irc, "Rejecting file transfer for %s", file->file_name ); 1325 1326 imcb_file_canceled( file->ic, file, "Denied by user" ); 1326 1327 } … … 1329 1330 if( file->local_id == fid ) 1330 1331 { 1331 irc_ usermsg( irc, "Canceling file transfer for %s", file->file_name );1332 irc_rootmsg( irc, "Canceling file transfer for %s", file->file_name ); 1332 1333 imcb_file_canceled( file->ic, file, "Canceled by user" ); 1333 1334 } … … 1339 1340 static void cmd_nick( irc_t *irc, char **cmd ) 1340 1341 { 1341 irc_ usermsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );1342 irc_rootmsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] ); 1342 1343 } 1343 1344 … … 1354 1355 1355 1356 if( msg ) 1356 irc_ usermsg( irc, "%s: This seems to be your first time using this "1357 irc_rootmsg( irc, "%s: This seems to be your first time using this " 1357 1358 "this version of BitlBee. Here's a list of new " 1358 1359 "features you may like to know about:\n\n%s\n", -
set.c
r87dddee r6e9ae72 112 112 } 113 113 114 int set_isvisible( set_t *set ) 115 { 116 /* the default value is not stored in value, only in def */ 117 return !( ( set->flags & SET_HIDDEN ) || 118 ( ( set->flags & SET_HIDDEN_DEFAULT ) && 119 ( set->value == NULL ) ) ); 120 } 121 114 122 int set_setstr( set_t **head, const char *key, char *value ) 115 123 { -
set.h
r87dddee r6e9ae72 49 49 SET_HIDDEN = 0x0200, 50 50 SET_PASSWORD = 0x0400, 51 SET_HIDDEN_DEFAULT = 0x0800, 51 52 } set_flags_t; 52 53 … … 98 99 int set_reset( set_t **head, const char *key ); 99 100 101 /* returns true if a setting shall be shown to the user */ 102 int set_isvisible( set_t *set ); 103 100 104 /* Two very useful generic evaluators. */ 101 105 char *set_eval_int( set_t *set, char *value ); -
storage_xml.c
r87dddee r6e9ae72 269 269 { 270 270 xd->unknown_tag ++; 271 irc_ usermsg( irc, "Warning: Unknown XML tag found in configuration file (%s). "271 irc_rootmsg( irc, "Warning: Unknown XML tag found in configuration file (%s). " 272 272 "This may happen when downgrading BitlBee versions. " 273 273 "This tag will be skipped and the information will be lost " … … 397 397 { 398 398 if( gerr && irc ) 399 irc_ usermsg( irc, "Error from XML-parser: %s", gerr->message );399 irc_rootmsg( irc, "Error from XML-parser: %s", gerr->message ); 400 400 401 401 g_clear_error( &gerr ); … … 473 473 if( ( fd = mkstemp( path ) ) < 0 ) 474 474 { 475 irc_ usermsg( irc, "Error while opening configuration file." );475 irc_rootmsg( irc, "Error while opening configuration file." ); 476 476 return STORAGE_OTHER_ERROR; 477 477 } … … 570 570 if( rename( path, path2 ) != 0 ) 571 571 { 572 irc_ usermsg( irc, "Error while renaming temporary configuration file." );572 irc_rootmsg( irc, "Error while renaming temporary configuration file." ); 573 573 574 574 g_free( path2 ); … … 585 585 g_free( pass_buf ); 586 586 587 irc_ usermsg( irc, "Write error. Disk full?" );587 irc_rootmsg( irc, "Write error. Disk full?" ); 588 588 close( fd ); 589 589
Note: See TracChangeset
for help on using the changeset viewer.