]> arthur.barton.de Git - ngircd-alex.git/blob - contrib/Anope/0009-ngircd-Update-protocol-module-for-current-Anope.patch
doc/Services.txt: Update documentation for Anope 1.9.8
[ngircd-alex.git] / contrib / Anope / 0009-ngircd-Update-protocol-module-for-current-Anope.patch
1 From e74a5303f2357f4a9915bb91038a2e326323db3c Mon Sep 17 00:00:00 2001
2 From: Alexander Barton <alex@barton.de>
3 Date: Fri, 25 Nov 2011 19:16:37 +0100
4 Subject: [PATCH 09/16] ngircd: Update protocol module for current Anope 1.9
5  GIT
6
7 This changes are rquired by:
8
9  - b14f5ea88: Fixed accidentally clearing botmodes when joins are sent
10  - cef3eb78d: Remove send_cmd and replace it with a stringstream
11  - ddc3c2f38: Added options:nonicknameownership config option
12 ---
13  modules/protocol/ngircd.cpp |   54 ++++++++++++++++++++++--------------------
14  1 files changed, 28 insertions(+), 26 deletions(-)
15
16 diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
17 index 2774168..55cb8d7 100644
18 --- a/modules/protocol/ngircd.cpp
19 +++ b/modules/protocol/ngircd.cpp
20 @@ -54,16 +54,22 @@ class ngIRCdProto : public IRCDProto
21  
22         void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf)
23         {
24 -               send_cmd(source ? source->nick : Config->ServerName, "WALLOPS :%s", buf.c_str());
25 +               UplinkSocket::Message(source ? source->nick : Config->ServerName) << "WALLOPS :" << buf;
26         }
27  
28 -       void SendJoin(User *user, Channel *c, ChannelStatus *status)
29 +       void SendJoin(User *user, Channel *c, const ChannelStatus *status)
30         {
31 -               send_cmd(user->nick, "JOIN %s", c->name.c_str());
32 +               UplinkSocket::Message(user->nick) << "JOIN " << c->name;
33                 if (status)
34                 {
35 +                       /* First save the channel status incase uc->Status == status */
36                         ChannelStatus cs = *status;
37 -                       status->ClearFlags();
38 +                       /* If the user is internally on the channel with flags, kill them so that
39 +                        * the stacker will allow this.
40 +                        */
41 +                       UserContainer *uc = c->FindUser(user);
42 +                       if (uc != NULL)
43 +                               uc->Status->ClearFlags();
44  
45                         BotInfo *setter = findbot(user->nick);
46                         for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
47 @@ -74,18 +80,18 @@ class ngIRCdProto : public IRCDProto
48  
49         void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
50         {
51 -               send_cmd(source ? source->nick : Config->ServerName, "KILL %s :%s", user->nick.c_str(), buf.c_str());
52 +               UplinkSocket::Message(source ? source->nick : Config->ServerName) << "KILL " << user->nick << " :" << buf;
53         }
54  
55         /* SERVER name hop descript */
56         void SendServer(const Server *server)
57         {
58 -               send_cmd("", "SERVER %s %d :%s", server->GetName().c_str(), server->GetHops(), server->GetDescription().c_str());
59 +               UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription();
60         }
61  
62         void SendConnect()
63         {
64 -               send_cmd("", "PASS %s 0210-IRC+ Anope|%s:CLHSo P", Config->Uplinks[CurrentUplink]->password.c_str(), Anope::VersionShort().c_str());
65 +               UplinkSocket::Message() << "PASS " << Config->Uplinks[CurrentUplink]->password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHSo P";
66                 /* Make myself known to myself in the serverlist */
67                 SendServer(Me);
68                 /* finish the enhanced server handshake and register the connection */
69 @@ -98,56 +104,52 @@ class ngIRCdProto : public IRCDProto
70                 Anope::string modes = "+" + u->GetModes();
71                 XLine x(u->nick, "Reserved for services");
72                 ircdproto->SendSQLine(NULL, &x);
73 -               send_cmd(Config->ServerName, "NICK %s 1 %s %s 1 %s :%s", u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str(), modes.c_str(), u->realname.c_str());
74 +               UplinkSocket::Message(Config->ServerName) << "NICK " << u->nick << " 1 " << u->GetIdent() << " " << u->host << " 1 " << modes << " :" << u->realname;
75         }
76  
77         void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf)
78         {
79                 if (!buf.empty())
80 -                       send_cmd(bi->nick, "PART %s :%s", chan->name.c_str(), buf.c_str());
81 +                       UplinkSocket::Message(bi->nick) << "PART " << chan->name << " :" << buf;
82                 else
83 -                       send_cmd(bi->nick, "PART %s", chan->name.c_str());
84 +                       UplinkSocket::Message(bi->nick) << "PART " << chan->name;
85         }
86  
87         void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf)
88         {
89 -Log(LOG_DEBUG) << "SendModeInternal 1";
90 -               send_cmd(bi ? bi->nick : Config->ServerName, "MODE %s %s", dest->name.c_str(), buf.c_str());
91 +               UplinkSocket::Message(bi ? bi->nick : Config->ServerName) << "MODE " << dest->name << " " << buf;
92         }
93  
94         void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf)
95         {
96 -Log(LOG_DEBUG) << "SendModeInternal 2";
97 -               send_cmd(bi ? bi->nick : Config->ServerName, "MODE %s %s", u->nick.c_str(), buf.c_str());
98 +               UplinkSocket::Message(bi ? bi->nick : Config->ServerName) << "MODE " << u->nick << " " << buf;
99         }
100  
101         void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf)
102         {
103                 if (!buf.empty())
104 -                       send_cmd(bi->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf.c_str());
105 +                       UplinkSocket::Message(bi->nick) << "KICK " << chan->name << " " << user->nick << " :" << buf;
106                 else
107 -                       send_cmd(bi->nick, "KICK %s %s", chan->name.c_str(), user->nick.c_str());
108 +                       UplinkSocket::Message(bi->nick) << "KICK " << chan->name << " " << user->nick;
109         }
110  
111 -       void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf)
112 +       void SendChannel(Channel *c)
113         {
114 -               send_cmd(source->nick, "NOTICE @%s :%s", dest->name.c_str(), buf.c_str());
115 +               Anope::string modes = c->GetModes(true, true);
116 +               UplinkSocket::Message(Config->ServerName) << "CHANINFO " << c->name << " +" << modes;
117         }
118  
119 -       /* INVITE */
120 -       void SendInvite(BotInfo *source, const Anope::string &chan, const Anope::string &nick)
121 +       void SendTopic(BotInfo *bi, Channel *c)
122         {
123 -               send_cmd(source->nick, "INVITE %s %s", nick.c_str(), chan.c_str());
124 +               UplinkSocket::Message(bi->nick) << "TOPIC " << c->name << " :" << c->topic;
125         }
126  
127 -       void SendChannel(Channel *c)
128 +       void SendLogin(User *u)
129         {
130 -               Anope::string modes = c->GetModes(true, true);
131 -               send_cmd(Config->ServerName, "CHANINFO %s +%s", c->name.c_str(), modes.c_str());
132         }
133 -       void SendTopic(BotInfo *bi, Channel *c)
134 +
135 +       void SendLogout(User *u)
136         {
137 -               send_cmd(bi->nick, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
138         }
139  };
140  
141 -- 
142 1.7.8.3
143