f3b5401817c9566420a3435cc4e4219c924399
1 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] 2 helo=mx.sourceforge.net) 3 by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) 4 (envelope-from <witchspace81@gmail.com>) id 1QhEKT-0000EB-Vu 5 for bitcoin-development@lists.sourceforge.net; 6 Thu, 14 Jul 2011 05:19:17 +0000 7 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of gmail.com 8 designates 209.85.161.175 as permitted sender) 9 client-ip=209.85.161.175; envelope-from=witchspace81@gmail.com; 10 helo=mail-gx0-f175.google.com; 11 Received: from mail-gx0-f175.google.com ([209.85.161.175]) 12 by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) 13 (Exim 4.76) id 1QhEKT-0005ar-6G 14 for bitcoin-development@lists.sourceforge.net; 15 Thu, 14 Jul 2011 05:19:17 +0000 16 Received: by gxk3 with SMTP id 3so3495337gxk.34 17 for <bitcoin-development@lists.sourceforge.net>; 18 Wed, 13 Jul 2011 22:19:11 -0700 (PDT) 19 MIME-Version: 1.0 20 Received: by 10.150.236.16 with SMTP id j16mr2042747ybh.15.1310620751689; Wed, 21 13 Jul 2011 22:19:11 -0700 (PDT) 22 Received: by 10.151.150.15 with HTTP; Wed, 13 Jul 2011 22:19:11 -0700 (PDT) 23 Date: Thu, 14 Jul 2011 05:19:11 +0000 24 Message-ID: <CAJNQ0st6Fo+VgVWj-AA5x8EvetZt4H=PR=n5q6NhZ6RyR0HYOA@mail.gmail.com> 25 From: John Smith <witchspace81@gmail.com> 26 To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net> 27 Content-Type: multipart/alternative; boundary=000e0cd2a07c56f93a04a800acb1 28 X-Spam-Score: -0.5 (/) 29 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. 30 See http://spamassassin.org/tag/ for more details. 31 -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for 32 sender-domain 33 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider 34 (witchspace81[at]gmail.com) 35 -0.0 SPF_PASS SPF: sender matches SPF record 36 0.1 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in 37 digit (witchspace81[at]gmail.com) 38 1.0 HTML_MESSAGE BODY: HTML included in message 39 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from 40 author's domain 41 0.1 DKIM_SIGNED Message has a DKIM or DK signature, 42 not necessarily valid 43 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 44 X-Headers-End: 1QhEKT-0005ar-6G 45 Subject: [Bitcoin-development] Notifications from client/wallet 46 X-BeenThere: bitcoin-development@lists.sourceforge.net 47 X-Mailman-Version: 2.1.9 48 Precedence: list 49 List-Id: <bitcoin-development.lists.sourceforge.net> 50 List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>, 51 <mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe> 52 List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development> 53 List-Post: <mailto:bitcoin-development@lists.sourceforge.net> 54 List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help> 55 List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>, 56 <mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe> 57 X-List-Received-Date: Thu, 14 Jul 2011 05:19:18 -0000 58 59 --000e0cd2a07c56f93a04a800acb1 60 Content-Type: text/plain; charset=ISO-8859-1 61 62 Hello all, 63 64 I'd like to add notifications to the client and wallet, to decouple UI and 65 core communication, and especially so that UIs no longer have to poll for 66 changes. 67 68 I propose to use the boost::signal mechanism for that. It is basically a 69 glorified callback system, but allows decoupled delivery of 'signals' from 70 an object. Multiple other objects can listen in on an event without the 71 emitting object having to care. 72 73 Wallet: 74 75 class CWallet { ... 76 boost::signal<void(int64)> balanceChanged; 77 } 78 79 void CWallet::newTx (...) { 80 ... 81 balanceChanged(new_balance); 82 ... 83 } 84 85 86 UI: 87 88 GUI::GUI(CWallet *wallet) { 89 ... 90 wallet->balanceChanged.connect(boost::bind(&GUI::balanceChanged, this, 91 _1)); 92 } 93 GUI::balanceChanged(int64 new_balance) { 94 someWidget->setValue(new_balance); 95 } 96 97 Specific notifications that would be useful: 98 99 Wallet: 100 101 - balanceChanged(int64): spendable balance changed 102 - transactionAdded(int256): new transaction added to wallet 103 - transactionUpdated(int256): transaction info changed 104 - transactionRemoved(int256): transaction removed from wallet (can this 105 happen? for completeness) 106 - addressAdded(int160): address was added to address book 107 - addressUpdated(int160): address label/other metadata was modified 108 - addressRemoved(int160): address was removed from address book 109 - notification(std::string message, int severity): warning/error occured 110 in wallet processing, notify user 111 - int askFee(std::string message, ...): ask user for fee 112 113 Network client: 114 115 - numConnectionsChanged(int): new connections / connections broken 116 - numBlocksChanged(int): new blocks came in or other changes to block 117 chain 118 - notification(std::string message, int severity): warning/error occured 119 in network processing, notify user 120 121 122 JS 123 124 --000e0cd2a07c56f93a04a800acb1 125 Content-Type: text/html; charset=ISO-8859-1 126 Content-Transfer-Encoding: quoted-printable 127 128 Hello all,<br><br>I'd like to add notifications to the client and walle= 129 t, to decouple UI and core communication, and especially so that UIs no lon= 130 ger have to poll for changes. <br><br>I propose to use the boost::signal me= 131 chanism for that. It is basically a glorified callback system, but allows d= 132 ecoupled delivery of 'signals' from an object. Multiple other objec= 133 ts can listen in on an event without the emitting object having to care. <b= 134 r> 135 <br>Wallet:<br><br><div style=3D"margin-left: 40px;">class CWallet { ...<br= 136 >=A0=A0=A0 boost::signal<void(int64)> balanceChanged;<br>}<br></div><= 137 br><div style=3D"margin-left: 40px;">void CWallet::newTx (...) {<br></div><= 138 div style=3D"margin-left: 40px;"> 139 =A0=A0=A0 ...<br>=A0=A0=A0 balanceChanged(new_balance);<br>=A0=A0=A0 ...<br= 140 >}<br></div><br><br>UI:<br><br><div style=3D"margin-left: 40px;">GUI::GUI(C= 141 Wallet *wallet) {<br>=A0=A0 ...<br>=A0=A0 wallet->balanceChanged.connect= 142 (boost::bind(&GUI::balanceChanged, this, _1));<br> 143 }<br>GUI::balanceChanged(int64 new_balance) {<br>=A0=A0 someWidget->setV= 144 alue(new_balance);<br>}<br></div><br>Specific notifications that would be u= 145 seful:<br><br>Wallet:<br><ul><li>balanceChanged(int64): spendable balance c= 146 hanged<br> 147 </li><li>transactionAdded(int256): new transaction added to wallet<br></li>= 148 <li>transactionUpdated(int256): transaction info changed<br></li><li>transa= 149 ctionRemoved(int256): transaction removed from wallet (can this happen? for= 150 completeness)</li> 151 <li>addressAdded(int160): address was added to address book<br></li><li>add= 152 ressUpdated(int160): address label/other metadata was modified<br></li><li>= 153 addressRemoved(int160): address was removed from address book<br></li><li> 154 notification(std::string message, int severity): warning/error occured in w= 155 allet processing, notify user<br></li><li>int askFee(std::string message, .= 156 ..): ask user for fee<br></li></ul>Network client:<br><ul><li>numConnection= 157 sChanged(int): new connections / connections broken<br> 158 </li><li>numBlocksChanged(int): new blocks came in or other changes to bloc= 159 k chain<br></li><li>notification(std::string message, int severity): warnin= 160 g/error occured in network processing, notify user<br></li></ul><br>JS<br> 161 162 --000e0cd2a07c56f93a04a800acb1-- 163 164