Send a PM to yourself
Moderator: Moderators
Send a PM to yourself
I've only just noticed that it's possible to send a PM to yourself, in which case the text appears twice. Any idea if someone has spotted this before (I can't see it after searching the forums) and if it is easily remedied?
At the most simple level, I'd guess that the command to send the PM could be prefixed by an if statement.
If sender != me, sendPM()
I've noticed that an analogous error message appears if you try to download something from yourself.
I've not looked at the actual syntax (as I currently couldn't even say which file it's in!) but is this easily amended or is it beyond someone with 3 days C++ experience?
At the most simple level, I'd guess that the command to send the PM could be prefixed by an if statement.
If sender != me, sendPM()
I've noticed that an analogous error message appears if you try to download something from yourself.
I've not looked at the actual syntax (as I currently couldn't even say which file it's in!) but is this easily amended or is it beyond someone with 3 days C++ experience?
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
-
- Posts: 164
- Joined: 2005-01-06 08:39
- Location: HU
- Contact:
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
I'm not claiming that this is a problem, let alone a major one. I'm just toying around with the program and compiling it after making tiny changes at my end.
More for practice of C++ than anything else I thought that I might do something like add an if statement to the block of code where PM's are sent.
I know that the code would become hideously bloated if you were to make it completely idiot proof (such as preventing this type of thing) but as I said this is selfishly for my benefit in terms of coding experience rather than for the greater good. You know, one day I might actually contribute something useful! (perish the thought).
One part of my original post still stands - is it as simple a matter as adding a small if statement or am I already out of my depth?
Ta in advance for any pointers.
More for practice of C++ than anything else I thought that I might do something like add an if statement to the block of code where PM's are sent.
I know that the code would become hideously bloated if you were to make it completely idiot proof (such as preventing this type of thing) but as I said this is selfishly for my benefit in terms of coding experience rather than for the greater good. You know, one day I might actually contribute something useful! (perish the thought).
One part of my original post still stands - is it as simple a matter as adding a small if statement or am I already out of my depth?
Ta in advance for any pointers.
Oh - I think I'm at least lukewarm
PrivateFrame.h:
void sendMessage(const tstring& msg) {
if(user && user->isOnline()) {
user->privateMessage(Text::fromT(msg));
string s = "<" + user->getClientNick() + "> " + Text::fromT(msg);
addLine(Text::toT(s));
}
and from PrivateFrame.cpp
void PrivateFrame::gotMessage(const User::Ptr& aUser, const tstring& aMessage) {
PrivateFrame* p = NULL;
Lock l(cs);
FrameIter i = frames.find(aUser);
if(i == frames.end()) {
bool found = false;
for(i = frames.begin(); i != frames.end(); ++i) {
if( (!i->first->isOnline()) &&
(i->first->getNick() == aUser->getNick()) &&
(i->first->getLastHubAddress() == aUser->getLastHubAddress()) ) {
Is it the bold bits alone that I'd be amending by adding an extra statement?
PrivateFrame.h:
void sendMessage(const tstring& msg) {
if(user && user->isOnline()) {
user->privateMessage(Text::fromT(msg));
string s = "<" + user->getClientNick() + "> " + Text::fromT(msg);
addLine(Text::toT(s));
}
and from PrivateFrame.cpp
void PrivateFrame::gotMessage(const User::Ptr& aUser, const tstring& aMessage) {
PrivateFrame* p = NULL;
Lock l(cs);
FrameIter i = frames.find(aUser);
if(i == frames.end()) {
bool found = false;
for(i = frames.begin(); i != frames.end(); ++i) {
if( (!i->first->isOnline()) &&
(i->first->getNick() == aUser->getNick()) &&
(i->first->getLastHubAddress() == aUser->getLastHubAddress()) ) {
Is it the bold bits alone that I'd be amending by adding an extra statement?
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
-
- Posts: 147
- Joined: 2003-01-04 02:20
- Location: Canada http://hub-link.sf.net
- Contact:
-
- Posts: 506
- Joined: 2003-01-03 07:33
Wow, there's one good excuse for me if I want to be lazy someday. Could you maybe give some examples on why this is?ivulfusbar wrote:if you want to learn C++, DC++ is absolutely not the best place to start. )
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."
Can't you just use the Notepad?Todi wrote:I like PM'ing myself (don't take that the wrong way). Both through usercommanda and regulary. PM'ing myself notes and the like, as well as PM'ing myself a TTH or filename i found in the search. It's nice.. and i wouldn't want to loose it. I see absolutely no need for such a "feature".
Which brings us to hijacking this thre for asking for a clear button inside NotePad ...Todi wrote:Notepad gets hopelessly cluddered after awhile. I like having timestamps of when i wrote something, and having it safely tucked away in my log file.
[url=dchub://greekcyprus.no-ip.org].::+LiVe-¦-OnCE-¦-WaiT-¦-foR-¦-eVeR+::..[/url]
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
You'd have to make an Undo button, since someone will press it by mistake. That's much more trouble than it's worth, especially since Control-End Hold Shift Control-Home Release Shift then Delete works.Herodes wrote:Which brings us to hijacking this thre for asking for a clear button inside NotePad ...
-
- Posts: 506
- Joined: 2003-01-03 07:33
oooh why do you want to take my freedom away? why do i need to give examples on when and how i use it? ooh why?Guitarm wrote:Wow, there's one good excuse for me if I want to be lazy someday. Could you maybe give some examples on why this is?ivulfusbar wrote:if you want to learn C++, DC++ is absolutely not the best place to start. ;))
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.
Hehe, I was actually trying to be serious. I'm not sure if you misunderstand me here. I just wanted your view in what the best method for learning C++ would be, nothing more - nothing less. You're in joke mode - I understand
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."